A15357 | Everyone Loves to Sleep
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Vlad, like everyone else, loves to sleep very much.
Every day Vlad has to do $n$ things, each at a certain time. For each of these things, he has an alarm clock set, the $i$ -th of them is triggered on $h_i$ hours $m_i$ minutes every day ( $0 \le h_i < 24, 0 \le m_i < 60$ ). Vlad uses the $24$ -hour time format, so after $h=12, m=59$ comes $h=13, m=0$ and after $h=23, m=59$ comes $h=0, m=0$ .
This time Vlad went to bed at $H$ hours $M$ minutes ( $0 \le H < 24, 0 \le M < 60$ ) and asks you to answer: how much he will be able to sleep until the next alarm clock.
If any alarm clock rings at the time when he went to bed, then he will sleep for a period of time of length $0$ .
Every day Vlad has to do $n$ things, each at a certain time. For each of these things, he has an alarm clock set, the $i$ -th of them is triggered on $h_i$ hours $m_i$ minutes every day ( $0 \le h_i < 24, 0 \le m_i < 60$ ). Vlad uses the $24$ -hour time format, so after $h=12, m=59$ comes $h=13, m=0$ and after $h=23, m=59$ comes $h=0, m=0$ .
This time Vlad went to bed at $H$ hours $M$ minutes ( $0 \le H < 24, 0 \le M < 60$ ) and asks you to answer: how much he will be able to sleep until the next alarm clock.
If any alarm clock rings at the time when he went to bed, then he will sleep for a period of time of length $0$ .
输入格式
The first line of input data contains an integer $t$ ( $1 \le t \le 100$ ) — the number of test cases in the test.
The first line of the case contains three integers $n$ , $H$ and $M$ ( $1 \le n \le 10, 0 \le H < 24, 0 \le M < 60$ ) — the number of alarms and the time Vlad went to bed.
The following $n$ lines contain two numbers each $h_i$ and $m_i$ ( $0 \le h_i < 24, 0 \le m_i < 60$ ) — the time of the $i$ alarm. It is acceptable that two or more alarms will trigger at the same time.
Numbers describing time do not contain leading zeros.
The first line of the case contains three integers $n$ , $H$ and $M$ ( $1 \le n \le 10, 0 \le H < 24, 0 \le M < 60$ ) — the number of alarms and the time Vlad went to bed.
The following $n$ lines contain two numbers each $h_i$ and $m_i$ ( $0 \le h_i < 24, 0 \le m_i < 60$ ) — the time of the $i$ alarm. It is acceptable that two or more alarms will trigger at the same time.
Numbers describing time do not contain leading zeros.
输出格式
Output $t$ lines, each containing the answer to the corresponding test case. As an answer, output two numbers — the number of hours and minutes that Vlad will sleep, respectively. If any alarm clock rings at the time when he went to bed, the answer will be 0 0.
输入输出样例
输入 #1
3 1 6 13 8 0 3 6 0 12 30 14 45 6 0 2 23 35 20 15 10 30
输出 #1
1 47 0 0 10 55
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted