103320: [Atcoder]ABC332 A - Online Shopping
Description
Score : $100$ points
Problem Statement
AtCoder Inc. sells merchandise through its online shop.
Takahashi has decided to purchase $N$ types of products from there.
For each integer $i$ from $1$ to $N$, the $i$-th type of product has a price of $P_i$ yen each, and he will buy $Q_i$ of this.
Additionally, he must pay a shipping fee.
The shipping fee is $0$ yen if the total price of the products purchased is $S$ yen or above, and $K$ yen otherwise.
He will pay the total price of the products purchased plus the shipping fee.
Calculate the amount he will pay.
Constraints
- $1\leq N\leq 100$
- $1\leq S\leq 10000$
- $1\leq K\leq 10000$
- $1\leq P_i\leq 10000$
- $1\leq Q_i\leq 100$
- All input values are integers.
Input
The input is given from Standard Input in the following format:
$N$ $S$ $K$ $P_1$ $Q_1$ $P_2$ $Q_2$ $\vdots$ $P_N$ $Q_N$
Output
Print the amount Takahashi will pay for online shopping.
Sample Input 1
2 2000 500 1000 1 100 6
Sample Output 1
2100
Takahashi buys one product for $1000$ yen and six products for $100$ yen each.
Thus, the total price of the products is $1000\times 1+100\times 6=1600$ yen.
Since the total amount for the products is less than $2000$ yen, the shipping fee will be $500$ yen.
Therefore, the amount Takahashi will pay is $1600+500=2100$ yen.
Sample Input 2
3 2000 500 1000 1 100 6 5000 1
Sample Output 2
6600
The total price of the products is $1000\times 1+100\times 6+5000\times 1=6600$ yen.
Since the total amount for the products is not less than $2000$ yen, the shipping fee will be $0$ yen.
Therefore, the amount Takahashi will pay is $6600+0=6600$ yen.
Sample Input 3
2 2000 500 1000 1 1000 1
Sample Output 3
2000
There may be multiple products with the same price per item.
Output
分数: 100分
问题描述
AtCoder Inc.通过其在线商店销售商品。
Takahashi决定在那里购买$N$种产品。
对于从1到$N$的每个整数$i$,第$i$种产品每件价格为$P_i$日元,他将购买$Q_i$件这个产品。
此外,他还必须支付运费。
如果购买的产品的总价格为$S$日元或以上,运费为0日元,否则为$K$日元。
他将支付购买的产品的总价格加上运费。
计算他将支付的金额。
约束
- $1\leq N\leq 100$
- $1\leq S\leq 10000$
- $1\leq K\leq 10000$
- $1\leq P_i\leq 10000$
- $1\leq Q_i\leq 100$
- 所有输入值都是整数。
输入
输入从标准输入以以下格式给出:
$N$ $S$ $K$ $P_1$ $Q_1$ $P_2$ $Q_2$ $\vdots$ $P_N$ $Q_N$
输出
打印Takahashi在线购物将支付的金额。
样例输入1
2 2000 500 1000 1 100 6
样例输出1
2100
Takahashi以1000日元的价格购买了一件产品,并以100日元的价格购买了6件产品。
因此,产品的总价格为$1000\times 1+100\times 6=1600$日元。
由于产品总额少于2000日元,运费为500日元。
因此,Takahashi将支付的金额为$1600+500=2100$日元。
样例输入2
3 2000 500 1000 1 100 6 5000 1
样例输出2
6600
产品的总价格为$1000\times 1+100\times 6+5000\times 1=6600$日元。
由于产品总额不