AT_abc467_b.Keep the Change
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Takahashi made purchases at N stores. Initially, he had 10000 yen.
At the i-th store, he bought an item worth Ai yen and paid Bi yen. Here, Ai≤Bi holds. If Si= keep, he did not receive the change, and if Si= take, he received the change.
Find the amount of money he lost compared to the case where he received the change at every store. To be precise,
- let X yen be Takahashi's final amount of money, and
- let Y yen be Takahashi's final amount of money in the case where he received the change at every store.
Find Y−X.
高桥在 N 家商店进行了购物。最初,他有 10000 日元。
在第 i 家商店,他购买了一件价值 Ai 日元的商品,并支付了 Bi 日元。其中满足 Ai≤Bi。若 Si= keep,则他未领取找零;若 Si= take,则他领取了找零。
求他相较于“在每家商店都领取找零”的情形所损失的金额。具体而言:
- 设 X 日元为高桥最终剩余的钱数;
- 设 Y 日元为高桥在“每家商店都领取找零”的情形下最终剩余的钱数。
请计算 Y−X。
输入格式
The input is given from Standard Input in the following format:
N
A1 B1 S1
A2 B2 S2
⋮
AN BN SN
输入从标准输入给出,格式如下:
N
A1 B1 S1
A2 B2 S2
⋮
AN BN SN
输出格式
Output the amount of money Takahashi lost compared to the case where he received the change at every store.
输出高桥君相较于在每家商店都找零的情况下所损失的金额。
输入输出样例
输入#1
3 1 2 keep 3 6 take 5 9 keep
输出#1
5
输入#2
8 36 49 take 38 73 keep 27 85 take 65 71 take 52 86 keep 48 60 keep 37 98 keep 5 38 keep
输出#2
175
说明/提示
Sample 1 Explanation:
Takahashi's actions are as follows.
- At the first store, he bought an item worth 1 yen, paid 2 yen, and did not receive the change.
- At the second store, he bought an item worth 3 yen, paid 6 yen, and received the change.
- At the third store, he bought an item worth 5 yen, paid 9 yen, and did not receive the change.
Constraints
- 1≤N≤100
- 1≤Ai≤Bi≤100
- Si is
keeportake. - N,Ai,Bi are all integers.
样例 1 解释:
高桥的行为如下:
- 在第一家商店,他购买了一件价值 1 日元的商品,支付了 2 日元,且未领取找零。
- 在第二家商店,他购买了一件价值 3 日元的商品,支付了 6 日元,且领取了找零。
- 在第三家商店,他购买了一件价值 5 日元的商品,支付了 9 日元,且未领取找零。
限制条件
- 1≤N≤100
- 1≤Ai≤Bi≤100
- Si 为
keep或take。 - N,Ai,Bi 均为整数。
输入解题思路,AI测评打分。不知道怎么写?