题目描述

XX年XX月XX日小cot学会了回文数,eg:121.

小cot上课容易走神, 经常看看这个,瞧瞧那个.在小cot某一次走神的过程中他发现电子表上的时间也有回文数...

当然,并不是每次走神小cot都能看到的时间都是回文数, 小cot想知道下一个这样的时间是多少?

输入

输入包含多组测试数据, 每组一个时间 HH:MM 表示小cot走神的时间.

输出

输出下一个回文数的时间.(时间格式HH:MM).

样例输入
: 样例输出
: 提示
采用24小时制

题目链接:http://acm.zznu.edu.cn/problem.php?id=1995

********************************************

题意:给你一个时间,你输出下一个回文的时刻。

分析:一起来水题。

AC代码:

 #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<limits.h>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <vector>
#include <queue>
#include <map> using namespace std; #define N 200000
#define INF 0x3f3f3f3f
#define met(a, b) memset (a, b, sizeof (a))//// met (dist, -1); int p(int x)
{
return (x+)%;
} int main()
{
int h,m,a; while(scanf("%d:%d",&h,&m) != EOF)
{
a=(h%)*+h/;///回文后的数字 if(a>m&&a>=&&a<)
{
printf("%02d:%02d\n",h,a);
continue ;
} while()
{
h=p(h);
a=(h%)*+h/; if(a>=&&a<)
{
printf("%02d:%02d\n", h,a);
break;
}
}
}
return ;
}

数据比较少,可以水过。

 #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<limits.h>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <vector>
#include <queue>
#include <map> using namespace std; #define N 200000
#define INF 0x3f3f3f3f
#define met(a, b) memset (a, b, sizeof (a))//// met (dist, -1); char s[]; int main()
{
int h,f,d; while(scanf("%s", s) != EOF)
{
h=(s[]-'')*+s[]-'';
f=(s[]-'')*+s[]-'';
d=h*+f; ///printf("%d\n", d); if(d>=&&d<)
printf("01:10\n");
else if(d>=&&d<)
printf("02:20\n");
else if(d>=&&d<)
printf("03:30\n");
else if(d>=&&d<)
printf("04:40\n");
else if(d>=&&d<)
printf("05:50\n");
else if(d>=&&d<)
printf("10:01\n");
else if(d>=&&d<)
printf("11:11\n");
else if(d>=&&d<)
printf("12:21\n");
else if(d>=&&d<)
printf("13:31\n");
else if(d>=&&d<)
printf("14:41\n");
else if(d>=&&d<)
printf("15:51\n");
else if(d>=&&d<)
printf("20:02\n");
else if(d>=&&d<)
printf("21:12\n");
else if(d>=&&d<)
printf("22:22\n");
else if(d>=&&d<)
printf("23:32\n");
else if(d>=)
printf("00:00\n");
}
return ;
}
05-11 10:54