Karen is getting ready for a new school day!
![](https://i-blog.csdnimg.cn/blog_migrate/fa676644715b5c28f7b60824cc612f49.png)
It is currently hh:mm, given in a 24-hour format. As you know, Karen lovespalindromes, 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.
The first and only line of input contains a single string in the format hh:mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 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.
05:39
11
13:31
0
23:59
1
In the first test case, the minimum number of minutes Karen should sleep for is11. 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 is1 minute. She can wake up at 00:00, when the time is a palindrome.
傻瓜模拟......
#include<bits/stdc++.h>
using namespace std;
bool judge(int a,int b){
if(a/10==b%10&&a%10==b/10) return true;
else return false;
}
int main(){
int hour,min;
int kount=0;
scanf("%d:%d",&hour,&min);
if(judge(hour,min)){
cout<<0<<endl;
return 0;
}
else{
while(1){
min++;
kount++;
if(min==60){
hour++;
min=0;
}
if(hour==24) hour=0;
if(judge(hour,min)){
cout<<kount<<endl;
break;
}
}
}
}