您的位置:首页 > 其它

CodeForces - 816A Karen and Morning(阅读题)

2017-08-23 21:17 330 查看

题目大意:

给你一个时间,问你至少再过多长时间,才能变成一个回文数。

代码:

#include<bits/stdc++.h>
using namespace std;

char s[10]={0};

int main()
{
scanf("%s",s);
int a,b,c,d;
a=s[0]-'0';
b=s[1]-'0';
c=s[3]-'0';
d=s[4]-'0';
int num=0;
while(1)
{
if(a==d&&b==c)break;
//cout<<a<<" "<<b<<c<<d<<endl;
num++;
d++;
if(d>=10)
{
d=0;
c++;
if(c>=6)
{
c=0;
b++;
if(b>=10)
{
b=0;a++;
}
if(a*10+b>=24)
{
a=0;b=0;
}
}
}
}
printf("%d",num);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息