2017 Multi-University Training Contest - Team 4 11.Time To Get Up(水模拟)
链接:http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1011&cid=762
题意:给定一个X和.组成的图案,输出图案里的数字。
分析:- - 一开始没看懂题目,没发现给的图里就是数字了。。打个0到9的表,直接读完判一下,就水过去了。。
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 char p[7][25]; 6 char num[10][30]={ 7 ".XX.X..XX..X....X..XX..X.XX.", 8 ".......X...X.......X...X....", 9 ".XX....X...X.XX.X...X....XX.", 10 ".XX....X...X.XX....X...X.XX.", 11 "....X..XX..X.XX....X...X....", 12 ".XX.X...X....XX....X...X.XX.", 13 ".XX.X...X....XX.X..XX..X.XX.", 14 ".XX....X...X.......X...X....", 15 ".XX.X..XX..X.XX.X..XX..X.XX.", 16 ".XX.X..XX..X.XX....X...X.XX." 17 }; 18 int Check(char s[30]){ 19 for(int i=0;i<10;i++){ 20 if(strcmp(s,num[i])==0)return i; 21 } 22 return -1; 23 } 24 int main(){ 25 int kase; 26 char s[40]; 27 int ans[4]; 28 scanf("%d",&kase); 29 while(kase--){ 30 for(int i=0;i<7;i++) 31 scanf("%s",p[i]); 32 s[0]='\0'; 33 for(int i=0;i<7;i++){ 34 strcat(s,p[i]); 35 s[4*i+4]='\0'; 36 } 37 ans[0]=Check(s); 38 s[0]='\0'; 39 for(int i=0;i<7;i++){ 40 strcat(s,p[i]+5); 41 s[4*i+4]='\0'; 42 } 43 ans[1]=Check(s); 44 s[0]='\0'; 45 for(int i=0;i<7;i++){ 46 strcat(s,p[i]+12); 47 s[4*i+4]='\0'; 48 } 49 ans[2]=Check(s); 50 s[0]='\0'; 51 for(int i=0;i<7;i++){ 52 strcat(s,p[i]+17); 53 s[4*i+4]='\0'; 54 } 55 ans[3]=Check(s); 56 printf("%d%d:%d%d\n",ans[0],ans[1],ans[2],ans[3]); 57 } 58 return 0; 59 }