码迷,mamicode.com
首页 > 其他好文 > 详细

CodeForces - 816A Karen and Morning 解题

时间:2017-07-19 12:06:22      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:ret   and   str   int   amp   blog   return   bsp   scanf   

这个题比较水~~~

 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 解题

标签:ret   and   str   int   amp   blog   return   bsp   scanf   

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

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!