CodeForces - 816A Karen and Morning 解题

这个题比较水~~~

 1 #include<stdio.h>
 2 #include<string.h>
 3 int main()
 4 {
 5     int a=0,b,i,j;
 6     char str1[6],str2[6];
 7     scanf("%s",&str1);
 8     for(i=0;;i++)
 9     {
10         for(j=0;j<5;j++)
11         {
12             str2[j]=str1[4-j];
13         }
14         if(strcmp(str1,str2)==0)
15         {
16             printf("%d",a);
17             return 0;
18         }
19         str1[4]+=1;
20         a++;
21         if(str1[4]=='9'+1)
22         {
23             str1[4]='0';
24             str1[3]+=1;
25         }
26         if(str1[3]=='6')
27         {
28             str1[3]='0';
29             str1[1]+=1;
30         }
31         if(str1[1]=='9'+1)
32         {
33             str1[1]='0';
34             str1[0]+=1;
35         }
36         if(str1[0]=='2'&&str1[1]=='4')
37         {
38             str1[0]='0';
39             str1[1]='0';
40             str1[3]='0';
41             str1[4]='0';
42         }
43     }
44 }

 

posted @ 2017-07-19 10:42  丿月华丶唯少  阅读(158)  评论(0编辑  收藏  举报