标签:check its integer his 翻译 job read clock string
题意:把字符串翻译成时间。
题解:直接利用他们的区别判断即可。
1 #include <iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<queue> 5 #include<map> 6 #include<vector> 7 #include<cmath> 8 #include<cstring> 9 using namespace std; 10 11 char time[7+1][21+1]; 12 int check(int i) 13 { 14 int j; 15 if(time[6][i]==‘X‘) 16 { 17 if(time[4][i+1]==‘.‘) 18 return 0; 19 else if(time[2][i]==‘.‘) 20 return 2; 21 else if(time[2][i+3]==‘.‘) 22 return 6; 23 else 24 return 8; 25 } 26 else 27 { 28 if(time[2][i]==‘X‘) 29 { 30 if(time[1][i+1]==‘X‘) 31 { 32 if(time[2][i+3]==‘X‘) 33 return 9; 34 else 35 return 5; 36 } 37 else 38 return 4; 39 } 40 else 41 { 42 if(time[4][i+1]==‘.‘) 43 { 44 if(time[1][i+1]==‘X‘) 45 return 7; 46 else 47 return 1; 48 } 49 else 50 return 3; 51 } 52 } 53 } 54 55 int main() 56 { 57 int a,b,c,d; 58 int T; 59 scanf("%d",&T); 60 while(T--) 61 { 62 for(int i=1;i<=7;i++) 63 for(int j=1;j<=21;j++) 64 cin>>time[i][j]; 65 a=check(1); 66 b=check(6); 67 c=check(13); 68 d=check(18); 69 printf("%d%d:%d%d\n",a,b,c,d); 70 } 71 return 0; 72 }
HDU 6077 17多校4 Time To Get Up 水题
标签:check its integer his 翻译 job read clock string
原文地址:http://www.cnblogs.com/Annetree/p/7289355.html