#abc210a. A - Cabbages
A - Cabbages
Score : points
问题描述
高桥正在访问一家专门卖白菜的商店。
该商店以每颗白菜 日元(日本货币)的价格出售。
但是,如果你一次性购买超过 颗白菜,则第 颗及以后的白菜将以每颗 日元的价格出售。
(保证 。参考样例输入/输出 1 以获取清晰理解。)
打印出购买 颗白菜所需的金额。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi is visiting a shop specializing in cabbage.
The shop sells cabbage for yen (Japanese currency) per head.
However, if you buy more than heads of cabbage at once, the -th and subsequent heads will be sold for yen per head.
(It is guaranteed that . See Sample Input/Output 1 for clarity.)
Print the amount of money needed to buy heads of cabbage.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the amount of money needed to buy heads of cabbage (as an integer).
Sample Input 1
5 3 20 15
Sample Output 1
90
You need to pay yen for each of the -st through -rd heads of cabbage, and yen for each of the -th and -th heads of cabbage.
Thus, you need to pay a total of yen for the heads of cabbage.
Sample Input 2
10 10 100 1
Sample Output 2
1000
update @ 2024/3/10 09:23:56