【题目链接】: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. [学习笔记] CS131 Computer Vision: Foundations and Applications:Lecture 2 颜色和数学基础

    大纲 what is color? The result of interaction between physical light in the environment and our visual ...

  2. SparkSql初级编程实践

    1.Spark SQL 基本操作将下列 JSON 格式数据复制到 Linux 系统中,并保存命名为 employee.json.{ "id":1 , "name" ...

  3. Vue系列(三):组件及数据传递、路由、单文件组件、vue-cli脚手架

    上一篇:Vue系列(二):发送Ajax.JSONP请求.Vue生命周期及实例属性和方法.自定义指令与过渡 一. 组件component 1. 什么是组件? 组件(Component)是 Vue.js ...

  4. [luogu] P3333 [ZJOI2013]丽洁体(贪心)

    P3333 [ZJOI2013]丽洁体 题目描述 平时的练习和考试中,我们经常会碰上这样的题:命题人给出一个例句,要我们类比着写句子.这种往往被称为仿写的题,不单单出现在小学生的考试中,也有时会出现在 ...

  5. ASP.NET-POSTBACK是什么

    当我们直接从服务端读取网页时,表时此网页并没有post(提交),当用户再次提交表单时,就会把此网页的相关参数传给服务器处理,对于服务器来说就是一个postback(提交返回),即提交回来了.这就是po ...

  6. Swift基础--定位

    // // ViewController.swift // JieCoreLocation // // Created by jiezhang on 14-10-4. // Copyright (c) ...

  7. Vuejs2.0学习之二(Render函数,createElement,vm.$slots,函数化组件,模板编译,JSX)

    时隔一周多,因为一些别的事情绊住了,下面接着写.中间这段时间也有看官方文档,发现正如他所说90%的基础内容都一样,所以这里直接跳到我比较关注的东东上,要是想看看哪些不一样,可以参考这个http://v ...

  8. SSIS故障排除

    1.2015.09.10 SSIS部署到SQL Server上 JOB任务无法执行 说是sa账户没有执行权限 解决办法:1)SQL Server 启动时使用windows管理员账户登录.2)部署的数据 ...

  9. 你不知道的JavaScript(三)字符串

    JavaScript字符串很容易被认为本质就是字符数组,ECMAScript规范中字符串作为一种单独的string类型,它的底层实现可能是数组,也可能是其他数据结构,因不同的JavaScript引擎而 ...

  10. HDU 1548 A strange lift【BFS】

    题意:给出一个电梯,给出它的层数f,给出起点s,终点g,以及在每一层能够上或者下w[i]层,问至少需要按多少次按钮到达终点. 和POJ catch that cow一样,直接用了那一题的代码,发现一直 ...