A1203 | [COCI-2010_2011-contest4]#1 ASTRO
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Ivica and Marica are attending astronomy classes and are observing two unusual stars. They noted the time when each of them flashed. They further noticed that each of the stars flashes periodically, at regular intervals, and now they are wondering: on what day, at what hour will the stars flash at the same minute for the first time?
For example, if the first star flashed today (Saturday) at 02:20 and the second one at 13:00, with the first star flashing every 05:50 (every 5 hours and 50 minutes) and the second every 01:00 (each hour), then the first one will flash again at 08:10 and 14:00, and the second one at 14:0
0. Therefore, both stars will have flashed at the same minute today at 14:0
0.
Note that the time 00:00 (midnight) is the first minute of a day.
For example, if the first star flashed today (Saturday) at 02:20 and the second one at 13:00, with the first star flashing every 05:50 (every 5 hours and 50 minutes) and the second every 01:00 (each hour), then the first one will flash again at 08:10 and 14:00, and the second one at 14:0
0. Therefore, both stars will have flashed at the same minute today at 14:0
0.
Note that the time 00:00 (midnight) is the first minute of a day.
输入格式
Four lines containing four timestamps in HH:MM format (hours:minutes), with 00 ≤ HH ≤ 23, 00 ≤
MM ≤ 5
9.
The timestamps are, respectively: the time of the first star’s flash, the time of the second star’s flash, the time between consecutive flashes of the first star, the time between consecutive flashes of the second star.
The first two timestamps will differ, and both fall on the same day - Saturday. Flash intervals will not be 00:0
0.
MM ≤ 5
9.
The timestamps are, respectively: the time of the first star’s flash, the time of the second star’s flash, the time between consecutive flashes of the first star, the time between consecutive flashes of the second star.
The first two timestamps will differ, and both fall on the same day - Saturday. Flash intervals will not be 00:0
0.
输出格式
If the stars will never flash at the same minute, output “Never” in a single line.
Otherwise, output in the first line (all lowercase) the name of the weekday of the first same-minute flash. A reminder on the correct spelling of weekdays: “Sunday”, “Monday”, “Tuesday”, “Wednesday”,
“Thursday”, “Friday” and “Saturday” (note the capital letter).
In the second line, output the timestamp of the first same-minute flash, in HH:MM format (with a leading zero if HH < 10).
Otherwise, output in the first line (all lowercase) the name of the weekday of the first same-minute flash. A reminder on the correct spelling of weekdays: “Sunday”, “Monday”, “Tuesday”, “Wednesday”,
“Thursday”, “Friday” and “Saturday” (note the capital letter).
In the second line, output the timestamp of the first same-minute flash, in HH:MM format (with a leading zero if HH < 10).
输入输出样例
输入 #1
02:20 13:00 05:50 01:00
输出 #1
Saturday 14:00
输入 #2
02:20 23:28 00:40 23:50
输出 #2
Never
输入 #3
23:19 10:19 02:42 09:11
输出 #3
Thursday 00:31
In test cases worth 40% of total points, both flash intervals will be hours-only (MM will equal 00), for
example 13:00.
example 13:00.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted