标签:log code return size bsp force ++i 时间 clu
题目大意:给你一个时间(hh:mm),求最少经过多少分钟才能使这个时间变成回文。
解题思路:模拟,先判断0的情况,然后每过1分钟判断一次即可。
C++ Code:
#include<cstdio> int main(){ int h,m; scanf("%d:%d",&h,&m); if(h==m%10*10+m/10){ puts("0"); return 0; } for(int i=1;;++i){ ++m; if(m==60){ m=0; ++h; if(h==24)h=0; } if(h==m%10*10+m/10){ printf("%d\n",i); return 0; } } }
[Codeforces 816A]Karen and Morning
标签:log code return size bsp force ++i 时间 clu
原文地址:http://www.cnblogs.com/Mrsrz/p/7397517.html