AT_abc465_b.Parking 2
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There is a parking lot. The fee for parking in this lot is as follows:
- During the period from exactly L o'clock to exactly R o'clock, a fee of X is charged for each hour parked.
- During the period not covered above, a fee of Y is charged for each hour parked.
If a car is parked in this lot from exactly A o'clock to exactly B o'clock without crossing midnight, how much is the fee?
有一个停车场。该停车场的停车费用规则如下:
- 在恰好从 L 点到恰好 R 点的时段内,每停车一小时收费 X;
- 在上述时段之外的时段内,每停车一小时收费 Y。
若一辆汽车在该停车场中恰好从 A 点停至恰好 B 点,且不跨午夜,那么总费用是多少?
输入格式
The input is given from Standard Input in the following format:
X Y L R A B
输入从标准输入中按以下格式给出:
X Y L R A B
输出格式
Output the answer.
输出答案。
输入输出样例
输入#1
700 300 9 17 7 21
输出#1
7400
输入#2
600 500 9 17 17 20
输出#2
1500
输入#3
900 200 12 14 11 13
输出#3
1100
说明/提示
Sample 1 Explanation:
If a car is parked from 7 o'clock to 21 o'clock, the fee is as follows.
- For the 2 hours from 7 o'clock to 9 o'clock, a fee of 300×2=600 is charged.
- For the 8 hours from 9 o'clock to 17 o'clock, a fee of 700×8=5600 is charged.
- For the 4 hours from 17 o'clock to 21 o'clock, a fee of 300×4=1200 is charged.
The answer is 600+5600+1200=7400.
Sample 2 Explanation:
If a car is parked from 17 o'clock to 20 o'clock, the fee is as follows.
- For the 3 hours from 17 o'clock to 20 o'clock, a fee of 500×3=1500 is charged.
The answer is 1500.
Constraints
- 1≤X,Y≤1000
- 1≤L<R≤23
- 1≤A<B≤23
- All input values are integers.
样例 1 解释:
若一辆汽车从 7 点停放到 21 点,费用计算如下:
- 从 7 点到 9 点的 2 小时,收费为 300×2=600;
- 从 9 点到 17 点的 8 小时,收费为 700×8=5600;
- 从 17 点到 21 点的 4 小时,收费为 300×4=1200。
答案为 600+5600+1200=7400。
样例 2 解释:
若一辆汽车从 17 点停放到 20 点,费用计算如下:
- 从 17 点到 20 点的 3 小时,收费为 500×3=1500。
答案为 1500。
约束条件
- 1≤X,Y≤1000
- 1≤L<R≤23
- 1≤A<B≤23
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?