http://codeforces.com/contest/816/problem/A

题意:

给出一个时间,问最少过多少时间后是回文串。

思路:

模拟,先把小时的逆串计算出来:

① 如果逆串=分钟,那么此时已经是回文串了。

② 如果逆串>分钟,那么只需要逆串-分钟即可。(注意此时逆串>=60的情况)

③ 如果逆串<分钟,此时在这个小时内要构成回文串已经是不可能的了,那么就加上60-minute分钟,进入一个新的小时,然后重复上述步骤。

 #include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<int,int> pll;
const int INF = 0x3f3f3f3f;
const int maxn=*1e5+; char str[]; int main()
{
//freopen("in.txt","r",stdin);
while(~scanf("%s",&str))
{
int hour = (str[]-'')* + (str[]-'');
int minute = (str[]-'')*+(str[]-'');
int rev_h = (str[]-'')*+str[]-'';
int rev_m = (str[]-'')*+(str[]-''); if(hour==rev_m) {puts("");continue;} int ans=;
while(true)
{
rev_h = (hour%*) + hour/;
if(rev_h == minute) break;
if(rev_h>minute && rev_h<)
{
ans+=rev_h-minute;
break;
} else
{
ans+=-minute;
minute=;
hour=(hour+)%;
}
}
printf("%d\n",ans);
}
return ;
}

Codeforces Round #419 (Div. 2) A. Karen and Morning(模拟)的更多相关文章

  1. Codeforces Round #419 (Div. 2) B. Karen and Coffee(经典前缀和)

    http://codeforces.com/contest/816/problem/B To stay woke and attentive during classes, Karen needs s ...

  2. Codeforces Round #419 (Div. 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 Round #419 (Div. 2) B. Karen and Coffee

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

  4. Codeforces Round #419 (Div. 2) E. Karen and Supermarket(树形dp)

    http://codeforces.com/contest/816/problem/E 题意: 去超市买东西,共有m块钱,每件商品有优惠卷可用,前提是xi商品的优惠券被用.问最多能买多少件商品? 思路 ...

  5. Codeforces Round #419 (Div. 1) C. Karen and Supermarket 树形DP

    C. Karen and Supermarket     On the way home, Karen decided to stop by the supermarket to buy some g ...

  6. 【找规律】【递推】【二项式定理】Codeforces Round #419 (Div. 1) B. Karen and Test

    打个表出来看看,其实很明显. 推荐打这俩组 11 1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000 1000000000 ...

  7. 【贪心】 Codeforces Round #419 (Div. 1) A. Karen and Game

    容易发现,删除的顺序不影响答案. 所以可以随便删. 如果行数大于列数,就先删列:否则先删行. #include<cstdio> #include<algorithm> usin ...

  8. Codeforces Round #367 (Div. 2) B. Interesting drink (模拟)

    Interesting drink 题目链接: http://codeforces.com/contest/706/problem/B Description Vasiliy likes to res ...

  9. Codeforces Round #419 (Div. 2)

    1.题目A:Karen and Morning 题意: 给出hh:mm格式的时间,问至少经过多少分钟后,该时刻为回文字符串? 思路: 简单模拟,从当前时刻开始,如果hh的回文rh等于mm则停止累计.否 ...

随机推荐

  1. 【BZOJ2768】[JLOI2010]冠军调查/【BZOJ1934】[Shoi2007]Vote 善意的投票 最小割

    [BZOJ2768][JLOI2010]冠军调查 Description 一年一度的欧洲足球冠军联赛已经进入了淘汰赛阶段.随着卫冕冠军巴萨罗那的淘汰,英超劲旅切尔西成为了头号热门.新浪体育最近在吉林教 ...

  2. iOS 根据经纬度计算与地理北极夹角

    http://www.aiuxian.com/article/p-2767848.html #define toDeg(X) (X*180.0/M_PI) /**  * @method 根据两点经纬度 ...

  3. mysql动态sql 整理多个字段

    原始表: 整理后的表: 方案一(动态sql): BEGIN #Routine body goes here... DECLARE v1 ); DECLARE v2 ); #DECLARE v3 VAR ...

  4. 【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo(转)

    标签: 1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be c ...

  5. 豆瓣api开发

    前面有说过豆瓣API的开发,在做一些开源项目的时候,很多时候会用到豆瓣API接口,拿过来做测试,现在只是对豆瓣API开发做一些简单的梳理: 豆瓣API开发的接口: https://developers ...

  6. 三维凸包(两个没有公共点)经过旋转平移后使其重心相距最近(POJ3862)

    Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 481   Accepted: 152   Special ...

  7. Oracle管理监控之段空间利用监控-oracle性能优化

    SELECT S.OWNER,       S.SEGMENT_NAME,       S.SEGMENT_TYPE,       S.PARTITION_NAME,       ROUND(BYTE ...

  8. D. Babaei and Birthday Cake---cf629D(LIS线段树优化)

    题目链接:http://codeforces.com/problemset/problem/629/D 题意就是现有n个蛋糕,蛋糕的形状是圆柱体,每个蛋糕的体积就是圆柱体的体积,每个蛋糕的编号是1-- ...

  9. 广通软件获“2016年度中国最具影响力IT运维管理软件提供商”殊荣

    12月16日,“科技原力觉醒引领创新巅峰”-- 2016创新影响力年会暨国家产业服务平台•2016年终评活动在北京裕龙国际酒店落下帷幕. 本活动在主管部门的指导参与下,总结本年度技术成果并籍此对未来科 ...

  10. JS事件常用事件

    oncontextmenu对象右击 举例1: <form id="form1" name="form1" method="post" ...