#abc321d. D - Set Menu
D - Set Menu
Score : points
问题描述
在 AtCoder 食堂提供了 种主菜和 种配菜。第 种主菜的价格为 ,而第 种配菜的价格为 。食堂正在考虑推出新的套餐菜单。一份套餐包含一份主菜和一份配菜。令 为主菜与配菜价格之和,则套餐的价格为 。这里的 是输入中给定的一个常数。
共有 种选择主菜和配菜组成套餐的方式。请计算所有这些套餐的总价。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
AtCoder cafeteria offers main dishes and side dishes. The price of the -th main dish is , and that of the -th side dish is . The cafeteria is considering introducing a new set meal menu. A set meal consists of one main dish and one side dish. Let be the sum of the prices of the main dish and the side dish, then the price of the set meal is . Here, is a constant given in the input.
There are ways to choose a main dish and a side dish for a set meal. Find the total price of all these set meals.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer. Under the constraints of this problem, it can be proved that the answer fits into a -bit signed integer.
Sample Input 1
2 2 7
3 5
6 1
Sample Output 1
24
- If you choose the first main dish and the first side dish, the price of the set meal is .
- If you choose the first main dish and the second side dish, the price of the set meal is .
- If you choose the second main dish and the first side dish, the price of the set meal is .
- If you choose the second main dish and the second side dish, the price of the set meal is .
Thus, the answer is .
Sample Input 2
1 3 2
1
1 1 1
Sample Output 2
6
Sample Input 3
7 12 25514963
2436426 24979445 61648772 23690081 33933447 76190629 62703497
11047202 71407775 28894325 31963982 22804784 50968417 30302156 82631932 61735902 80895728 23078537 7723857
Sample Output 3
2115597124
update @ 2024/3/10 01:40:39