首页 > 其他 > 详细

CodeForces - 816A Karen and Morning 解题

时间:2017-07-19 11:24:24      阅读:229      评论:0      收藏:0      [点我收藏+]

这个题比较水~~~

 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 }

 

CodeForces - 816A Karen and Morning 解题

原文:http://www.cnblogs.com/lyf0031/p/7204475.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!