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 LL o'clock to exactly RR o'clock, a fee of XX is charged for each hour parked.
  • During the period not covered above, a fee of YY is charged for each hour parked.

If a car is parked in this lot from exactly AA o'clock to exactly BB o'clock without crossing midnight, how much is the fee?

有一个停车场。该停车场的停车费用规则如下:

  • 在恰好从 LL 点到恰好 RR 点的时段内,每停车一小时收费 XX;
  • 在上述时段之外的时段内,每停车一小时收费 YY。

若一辆汽车在该停车场中恰好从 AA 点停至恰好 BB 点,且不跨午夜,那么总费用是多少?

输入格式

The input is given from Standard Input in the following format:

XX YY LL RR AA BB

输入从标准输入中按以下格式给出:

XX YY LL RR AA BB

输出格式

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 77 o'clock to 2121 o'clock, the fee is as follows.

  • For the 22 hours from 77 o'clock to 99 o'clock, a fee of 300×2=600300 \times 2 = 600 is charged.
  • For the 88 hours from 99 o'clock to 1717 o'clock, a fee of 700×8=5600700 \times 8 = 5600 is charged.
  • For the 44 hours from 1717 o'clock to 2121 o'clock, a fee of 300×4=1200300 \times 4 = 1200 is charged.

The answer is 600+5600+1200=7400600 + 5600 + 1200 = 7400.

Sample 2 Explanation:
If a car is parked from 1717 o'clock to 2020 o'clock, the fee is as follows.

  • For the 33 hours from 1717 o'clock to 2020 o'clock, a fee of 500×3=1500500 \times 3 = 1500 is charged.

The answer is 15001500.

Constraints

  • 1≤X,Y≤10001 \leq X, Y \leq 1000
  • 1≤L<R≤231 \leq L < R \leq 23
  • 1≤A<B≤231 \leq A < B \leq 23
  • All input values are integers.

样例 1 解释:
若一辆汽车从 7 点停放到 21 点,费用计算如下:

  • 从 7 点到 9 点的 2 小时,收费为 300×2=600300 \times 2 = 600;
  • 从 9 点到 17 点的 8 小时,收费为 700×8=5600700 \times 8 = 5600;
  • 从 17 点到 21 点的 4 小时,收费为 300×4=1200300 \times 4 = 1200。

答案为 600+5600+1200=7400600 + 5600 + 1200 = 7400。

样例 2 解释:
若一辆汽车从 17 点停放到 20 点,费用计算如下:

  • 从 17 点到 20 点的 3 小时,收费为 500×3=1500500 \times 3 = 1500。

答案为 15001500。

约束条件

  • 1≤X,Y≤10001 \leq X, Y \leq 1000
  • 1≤L<R≤231 \leq L < R \leq 23
  • 1≤A<B≤231 \leq A < B \leq 23
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页