CF665A.Buses Between Cities
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Buses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the city A departs every a minutes and arrives to the city B in a t__a minutes, and a bus from the city B departs every b minutes and arrives to the city A in a t__b minutes.
The driver Simion wants to make his job diverse, so he counts the buses going towards him. Simion doesn't count the buses he meet at the start and finish.
You know the time when Simion departed from the city A to the city B. Calculate the number of buses Simion will meet to be sure in his counting.
公交车在城市 A 和 B 之间运行,首班车于上午 05:00 发车,末班车不晚于晚上 11:59 发车。从城市 A 出发的公交车每 a 分钟一班,到达城市 B 需要 t__a 分钟;从城市 B 出发的公交车每 b 分钟一班,到达城市 A 需要 t__b 分钟。
司机西蒙希望让自己的工作更富变化,因此他统计所有迎面驶来的公交车数量。西蒙不统计他在起点(城市 A)和终点(城市 B)恰好遇到的公交车。
已知西蒙从城市 A 前往城市 B 的出发时间。请计算西蒙在途中将会遇到的公交车数量,以确保他的统计准确无误。
输入格式
The first line contains two integers a, t__a (1 ≤ a, t__a ≤ 120) — the frequency of the buses from the city A to the city B and the travel time. Both values are given in minutes.
The second line contains two integers b, t__b (1 ≤ b, t__b ≤ 120) — the frequency of the buses from the city B to the city A and the travel time. Both values are given in minutes.
The last line contains the departure time of Simion from the city A in the format hh:mm. It is guaranteed that there are a bus from the city A at that time. Note that the hours and the minutes are given with exactly two digits.
第一行包含两个整数 a、ta(1≤a,ta≤120)——分别表示从城市 A 到城市 B 的公交车发车频率和单程旅行时间(单位:分钟)。
第二行包含两个整数 b、tb(1≤b,tb≤120)——分别表示从城市 B 到城市 A 的公交车发车频率和单程旅行时间(单位:分钟)。
最后一行包含西蒙从城市 A 出发的时间,格式为 hh:mm。保证在该时刻恰好有一班从城市 A 出发的公交车。注意:小时和分钟均以恰好两位数字给出。
输出格式
Print the only integer z — the number of buses Simion will meet on the way. Note that you should not count the encounters in cities A and B.
输出唯一的整数 z —— Simion 在途中将遇到的公交车数量。注意:你不应统计在城市 A 和 B 中的相遇。
输入输出样例
输入#1
10 30 10 35 05:20
输出#1
5
输入#2
60 120 24 100 13:00
输出#2
9
说明/提示
In the first example Simion departs form the city A at 05:20 AM and arrives to the city B at 05:50 AM. He will meet the first 5 buses from the city B that departed in the period [05:00 AM - 05:40 AM]. Also Simion will meet a bus in the city B at 05:50 AM, but he will not count it.
Also note that the first encounter will be between 05:26 AM and 05:27 AM (if we suggest that the buses are go with the sustained speed).
在第一个例子中,西米恩于上午 05:20 从城市 A 出发,并于上午 05:50 到达城市 B。他将遇到在时间段 [05:00 AM - 05:40 AM] 内从城市 B 出发的前 5 辆公交车。此外,西米恩还将在上午 05:50 在城市 B 遇到一辆公交车,但他不会将其计入。
还需注意,第一次相遇将发生在上午 05:26 至 05:27 之间(假设公交车以恒定速度行驶)。
输入解题思路,AI测评打分。不知道怎么写?