103100: [Atcoder]ABC310 A - Order Something Else
Description
Score : $100$ points
Problem Statement
Takahashi wants a beverage called AtCoder Drink in a restaurant. It can be ordered at a regular price of $P$ yen.
He also has a discount coupon that allows him to order it at a lower price of $Q$ yen. However, he must additionally order one of the restaurant's $N$ dishes to use that coupon. For each $i = 1, 2, \ldots, N$, the price of the $i$-th dish is $D_i$ yen.
Print the minimum total amount of money that he must pay to get the drink.
Constraints
- $1 \leq N \leq 100$
- $1 \leq Q \lt P \leq 10^5$
- $1 \leq D_i \leq 10^5$
- All input values are integers.
Input
The input is given from Standard Input in the following format:
$N$ $P$ $Q$ $D_1$ $D_2$ $\ldots$ $D_N$
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 $50$ yen for it and $20$ yen for the dish, for a total of $70$ 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 $100$ yen.
Input
题意翻译
## 题目描述 高桥来到餐馆,想喝一杯$P$日元的饮料。他有**一张**能将饮料价格**降至**$Q$日元的优惠券。 但是他要想使用优惠券,得先订一份餐馆里的菜。菜有$N$种,第$i$种的价格是$D_i(1\le i \le N)$日元。 请问高桥至少花多少日元才能喝到这杯饮料? ## 数据范围 $ 1 \le N \le 100\\ 1 \le Q \le P \le 10^5\\ 1 \le D_i \le 10^5\\$ 输入数据均为整数。Output
分数:100分
问题描述
高桥凉介在一家餐厅想喝一杯叫做AtCoder Drink的饮料,它的原价是P日元。
他还有一张折扣券,可以让他以更低的价格Q日元购买。但是,他必须另外点一份餐厅的N种菜品之一才能使用这张折扣券。对于每个$i = 1, 2, \ldots, N$,第i道菜的价格是$D_i$日元。
打印他必须支付的最低总金额来购买饮料。
限制条件
- $1 \leq N \leq 100$
- $1 \leq Q \lt P \leq 10^5$
- $1 \leq D_i \leq 10^5$
- 所有的输入值都是整数。
输入
输入从标准输入按以下格式给出:
$N$ $P$ $Q$ $D_1$ $D_2$ $\ldots$ $D_N$
输出
打印答案。
样例输入1
3 100 50 60 20 40
样例输出1
70
如果他使用折扣券并点第二道菜,他可以通过为饮料支付50日元和为菜品支付20日元,总共支付70日元,这是需要支付的最低总金额。
样例输入2
3 100 50 60000 20000 40000
样例输出2
100
通过不使用折扣券并支付原价100日元,总支付金额将被最小化。