#abc310a. A - Order Something Else
A - Order Something Else
Score : points
问题描述
Takahashi 在一家餐厅想要一杯名为 的饮料。这款饮料的正常售价为 日元。
他还有一张折扣券,可以让他以更低的价格 Q 日元购买这款饮料。但是,为了使用这张优惠券,他必须额外点一道该餐厅的 N 道菜中的一道。对于每 第 道菜的价格为 日元。
请输出他要获取这款饮料所需的最低总价。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi wants a beverage called AtCoder Drink in a restaurant. It can be ordered at a regular price of yen.
He also has a discount coupon that allows him to order it at a lower price of yen. However, he must additionally order one of the restaurant's dishes to use that coupon. For each , the price of the -th dish is yen.
Print the minimum total amount of money that he must pay to get the drink.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 100 50
60 20 40
Sample Output 1
70
If he uses the coupon and orders the second dish, he can get the drink by paying yen for it and yen for the dish, for a total of yen, which is the minimum total payment needed.
Sample Input 2
3 100 50
60000 20000 40000
Sample Output 2
100
The total payment will be minimized by not using the coupon and paying the regular price of yen.
update @ 2024/3/10 08:47:25