CF816A.Karen and Morning

入门

通过率:0%

时间限制:2.00s

内存限制:512MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Karen is getting ready for a new school day!

It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome.

What is the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome?

Remember that a palindrome is a string that reads the same forwards and backwards. For instance, 05:39 is not a palindrome, because 05:39 backwards is 93:50. On the other hand, 05:50 is a palindrome, because 05:50 backwards is 05:50.

凯伦正在为新的一天上学做准备!

当前时间为 hh:mm(24 小时制)。众所周知,凯伦非常喜欢回文串,她相信在时间显示为回文串时醒来会带来好运。

请问:她至少还需要睡多少分钟,才能在醒来时看到一个回文时间?

注意:回文串是指正读与反读都完全相同的字符串。例如,05:39 不是回文串,因为将其反转后得到 93:50;而 05:50 是回文串,因为将其反转后仍为 05:50。

输入格式

The first and only line of input contains a single string in the format hh:mm (00 ≤  hh  ≤ 23, 00 ≤  mm  ≤ 59).

输入仅有一行,包含一个格式为 hh:mm 的字符串(其中 00≤hh≤2300 \leq hh \leq 23,00≤mm≤5900 \leq mm \leq 59)。

输出格式

Output a single integer on a line by itself, the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome.

在单独一行输出一个整数,表示她至少需要睡眠的分钟数,使得她醒来时的时间是一个回文。

输入输出样例

  • 输入#1

    05:39

    输出#1

    11
  • 输入#2

    13:31

    输出#2

    0
  • 输入#3

    23:59

    输出#3

    1

说明/提示

In the first test case, the minimum number of minutes Karen should sleep for is 11. She can wake up at 05:50, when the time is a palindrome.

In the second test case, Karen can wake up immediately, as the current time, 13:31, is already a palindrome.

In the third test case, the minimum number of minutes Karen should sleep for is 1 minute. She can wake up at 00:00, when the time is a palindrome.

在第一个测试用例中,Karen 至少需要睡眠 11 分钟。她可以在 05:50 醒来,此时的时间是一个回文。

在第二个测试用例中,Karen 可以立即醒来,因为当前时间 13:31 本身就是一个回文。

在第三个测试用例中,Karen 至少需要睡眠 1 分钟。她可以在 00:00 醒来,此时的时间是一个回文。

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

首页