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, because 05: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  ≤ 23, 00 ≤  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<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
int cnt;
bool judge(int a,int b)
{
if(a/==b%&&a%==b/)return ;
else return ;
}
int main()
{
int a,b;
scanf("%d:%d",&a,&b);
if(judge(a,b)){cout<<;return ;}
while(!judge(a,b))
{
b++;
cnt++;
if(b==){a++;b=;}
if(a==){a=;}
}
cout<<cnt;
return ;
}

A. Karen and Morning的更多相关文章

  1. B. Karen and Coffee

    B. Karen and Coffee time limit per test 2.5 seconds memory limit per test 512 megabytes input standa ...

  2. C. Karen and Game

    C. Karen and Game time limit per test 2 seconds memory limit per test 512 megabytes input standard i ...

  3. CodeForces 816B Karen and Coffee(前缀和,大量查询)

    CodeForces 816B Karen and Coffee(前缀和,大量查询) Description Karen, a coffee aficionado, wants to know the ...

  4. codeforces 815C Karen and Supermarket

    On the way home, Karen decided to stop by the supermarket to buy some groceries. She needs to buy a ...

  5. codeforces round #419 E. Karen and Supermarket

    On the way home, Karen decided to stop by the supermarket to buy some groceries. She needs to buy a ...

  6. Codeforces Round #460 D. Karen and Cards

    Description Karen just got home from the supermarket, and is getting ready to go to sleep. After tak ...

  7. codeforces round #419 C. Karen and Game

    C. Karen and Game time limit per test 2 seconds memory limit per test 512 megabytes input standard i ...

  8. codeforces round #419 B. Karen and Coffee

    To stay woke and attentive during classes, Karen needs some coffee! Karen, a coffee aficionado, want ...

  9. codeforces round #419 A. Karen and Morning

    Karen is getting ready for a new school day! It is currently hh:mm, given in a 24-hour format. As yo ...

随机推荐

  1. hdu1698线段树区间更新

    题目链接:https://vjudge.net/contest/66989#problem/E 坑爹的线段树照着上一个线段树更新写的,结果发现有一个地方就是不对,找了半天,发现是延迟更新标记加错了!! ...

  2. VS2015如何新建C++或者C语言版的lib文件

    当我们不想公开我们的代码的时候,可以把我们的代码封装成静态数据连接库,即lib文件.下面介绍下如何生成lib文件. 以VS2015为例,一种是C++版的lib文件,一种是C语言版的lib文件. 一.按 ...

  3. iOS-SQLite(FMDB)

    在已经存在的表中,添加字段,更新表结构 /** Test to see if particular column exists for particular table in database @pa ...

  4. 谷歌统计使用代码部署和事件API使用

    谷歌统计代码部署和API使用 1.注册谷歌账号 要使用GA,必需先成为GOOGLE的注册用户,如果没有请去注册.当然,你有GMAIL邮箱就可以.邮箱就是帐户名. 2.开启Google Analytic ...

  5. Docker - 访问仓库

    仓库与注册服务器 仓库(Repository)集中存放镜像的项目或目录. 注册服务器(Registry)管理仓库的服务器,服务器上可以有多个仓库,每个仓库有多个镜像. 例如:在仓库地址docker.i ...

  6. document.all 用法

    一. document.all是页面内所有元素的一个集合.例如:        document.all(0)表示页面内第一个元素 二. document.all可以判断浏览器是否是IE     if ...

  7. Hbase的架构原理、核心概念

    Hbase的架构原理.核心概念 1.Hbase的表.行.列.列族 2.核心组件: Table和region Table在行的方向上分割为多个HRegion, 一个region由[startkey,en ...

  8. java jdk中安装证书的步骤

    需要注意的是:导入证书时,请确认导入的JDK为当前程序运行所用的JDK,且路径是jdk目录下的jre目录路径,非与jdk同级的jre目录 首先你可以把需要导入的证书放在keytool的同级目录下,然后 ...

  9. HTM CSS 笔记乱炖

    一.常用实体(字符转义) '<' == '<' '©' == '©' '>' == '>' '"' == '"' ' ' == ' ' '®' == '®' ...

  10. .Net程序员学用Oracle系列(10):系统函数(中)

    1.四大转换函数 1.1.TO_CHAR 1.2.TO_NUMBER 1.3.TO_DATE 1.4.CAST 2.两大近似值函数 2.1.ROUND 2.2.TRUNC 3.正则函数 3.1.正则函 ...