【题目链接】:http://codeforces.com/contest/816/problem/A

【题意】



让你一分钟一分钟地累加时间;

问多长时间以后是个回文串;

【题解】



reverse之后如果和原串相同,则为回文串;

模拟就好



【Number Of WA】



0



【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0) typedef pair<int,int> pii;
typedef pair<LL,LL> pll; const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110; int n;
int h,m; string zh(int h,int m){
int a,b,c,d;
a = h/10;
string s = "";
s+= (char) a + '0';
b = h%10;
s+= (char) b + '0';
s+=':';
c = m/10;
s+=(char) c+'0';
d = m%10;
s+=(char) d+'0';
return s;
} int main(){
//Open();
Close();
scanf("%d:%d",&h,&m);
int now = 0;
while (1){
string s = zh(h,m);
string ts = s;
reverse(ts.begin(),ts.end());
if (ts==s){
cout << now<<endl;
return 0;
}
now++;
m++;
if (m>59){
m = 0;
h++;
if (h>23) h = 0;
}
}
return 0;
}

【codeforces 816A】Karen and Morning的更多相关文章

  1. 【codeforces 816C】Karen and Game

    [题目链接]:http://codeforces.com/contest/816/problem/C [题意] 给你一个n*m的矩阵; 一开始所有数字都是0; 每次操作,你能把某一行,或某一列的数字全 ...

  2. 【codeforces 816B】Karen and Coffee

    [题目链接]:http://codeforces.com/contest/816/problem/B [题意] 给你很多个区间[l,r]; 1<=l<=r<=2e5 一个数字如果被k ...

  3. 【Codeforces 815C】Karen and Supermarket

    Codeforces 815 C 考虑树型dp. \(dp[i][0/1][k]\)表示现在在第i个节点, 父亲节点有没有选用优惠, 这个子树中买k个节点所需要花的最小代价. 然后转移的时候枚举i的一 ...

  4. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  5. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  6. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  7. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  8. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  9. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

随机推荐

  1. CommonJS 与 ES6 的依赖操作方法(require、import)

    CommonJS:http://www.commonjs.org/specs/modules/1.0/ ES2015的 export:https://developer.mozilla.org/en- ...

  2. 一些sass

    # sass #---sass---定义变量:--    $变量名:  : 默认变量    sass的默认变量仅需要在值后面加上!default即可.list--list数据可通过空格,逗号或小括号分 ...

  3. js追加元素

    直接运行 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <titl ...

  4. python_购物车程序

    #需求1.启动程序后,让用户输入工资,然后打印商品列表2.允许用户根据商品编号购买商品3.用户选择商品后,检测余额是否够,够就直接扣款,不够就提醒4.可随时退出,退出时,打印已购买商品和余额 #先定义 ...

  5. django-3-模板变量,过滤器,静态文件的引用

    <<<模板变量>>> (1)定义视图函数 通过context传递参数来渲染模板,context要是个字典 当模板变量为可调用对象的时候,函数不传递参数 (2)配置模 ...

  6. 利用 ST-LINK Utility软件下载程序

    先在电脑上安装STM32 ST-LINK Utility,软件安装一路Next就可以了,安装好软件之后界面如下:    下载程序只需要使用3个图标就可以了 第一个图标Connect to the ta ...

  7. springboot项目封装为docker镜像

    1.本次镜像的基础镜像是:https://www.cnblogs.com/JoeyWong/p/9173265.html 2.将打包好的项目文件放在与Dockerfile同级的目录下 3.Docker ...

  8. 数据库范式1NF 2NF 3NF BCNF(实例)通俗易懂的讲解

    [转] 数据库范式1NF 2NF 3NF BCNF(实例)通俗易懂的讲解     本文对大多数初学数据库原理的同学绝对是个大福利,哈哈,完完整整的看完此篇博文一定能够清晰地理解数据库的四大范式.    ...

  9. HTML页面直接显示json 结构

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  10. Qt之窗体透明

    简述 关于窗体透明,经常遇到,下面我们针对常用的透明效果进行讲解: 全透明(主窗体.子窗体均透明) 主窗体透明(子窗体不透明) 子窗体透明(主窗体不透明) 简述 正常状态 全透明 效果 源码 主窗体透 ...