codeforces 816A Karen and Morning

来源:互联网 发布:网络设计是什么级别 编辑:程序博客网 时间:2024/06/01 10:19


A. Karen and Morning
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

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, because05:39 backwards is 93:50. On the other hand, 05:50 is a palindrome, because 05:50 backwards is 05:50.

Input

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

Output

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.

Examples
input
05:39
output
11
input
13:31
output
0
input
23:59
output
1
Note

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.



#include <iostream>#include <string>#include <cstdio>#include <algorithm>#include <string>#include <cmath>#include <cstring>using namespace std;const int MAXN=5000+10;int h,m;int main(){    scanf("%d:%d",&h,&m);    for(int i=0;i<=10000000;i++){        if(m%10==h/10&&m/10==h%10){            printf("%d\n",i);            break;        }        h=(h+(m+1)/60)%24;        m=(m+1)%60;    }}












原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 发现老婆衣柜里有避孕套怎么办 2岁宝宝爱舔东西怎么办 痔疮手术后痛疼怎么办 长了内痔疮该怎么办 淘宝卖家遇到恶意买家怎么办 淘宝遇到恶意买家拍单怎么办 淘宝遇到买家恶意搞坏商品怎么办 木油味道很重怎么办 床垫外面布坏了怎么办 淘宝店铺动态评分低怎么办 实创倒闭返款怎么办 qq红包忘记支付密码怎么办 qq红包支付密码忘了怎么办 个人卖东西人家要发票怎么办 打了欠条找不到人怎么办 公章掉进水里了怎么办 手游吃鸡限制登入15分钟怎么办 宝宝的小鸡淹了怎么办 宝宝小鸡底下淹了怎么办 4岁宝宝拉稀水怎么办 2岁半宝宝对眼怎么办 孩子在幼儿园中午不睡觉怎么办 20天婴儿拉稀水怎么办 3个月婴儿拉水怎么办 两岁宝宝拉水怎么办 1岁半宝宝拉水怎么办 5周孩子小鸡长脂肪粒怎么办 小孩丁丁长歪了怎么办 2个月的婴儿咳嗽怎么办 2个月的宝宝干咳怎么办 2月宝宝感冒咳嗽怎么办 产妇肚子上长小疙瘩很痒怎么办 泰迪生下小狗不吃奶怎么办? 刚生的狗不吃奶怎么办 刚出生的小牛不吃奶怎么办 吃奶的狗崽拉稀怎么办 新生儿吃奶老是呛到怎么办 刚生小狗不吃奶怎么办 刚出生的小羊不吃奶怎么办 羔羊走路不稳不吃奶怎么办 新生儿喝奶老是呛到怎么办