Time To Get Up
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0
Problem Description
Little Q's clock is alarming! It's time to get up now! However, after reading the time on the clock, Little Q lies down and starts sleeping again. Well, he has
5
alarms, and it's just the first one, he can continue sleeping for a while.
Little Q's clock uses a standard 7-segment LCD display for all digits, plus two small segments for the '':'', and shows all times in a 24-hour format. The '':'' segments are on at all times.
Your job is to help Little Q read the time shown on his clock.
Little Q's clock uses a standard 7-segment LCD display for all digits, plus two small segments for the '':'', and shows all times in a 24-hour format. The '':'' segments are on at all times.
Your job is to help Little Q read the time shown on his clock.
Input
The first line of the input contains an integer
T(1≤T≤1440)
, denoting the number of test cases.
In each test case, there is an 7×21 ASCII image of the clock screen.
All digit segments are represented by two characters, and each colon segment is represented by one character. The character ''X'' indicates a segment that is on while ''.'' indicates anything else. See the sample input for details.
In each test case, there is an 7×21 ASCII image of the clock screen.
All digit segments are represented by two characters, and each colon segment is represented by one character. The character ''X'' indicates a segment that is on while ''.'' indicates anything else. See the sample input for details.
Output
For each test case, print a single line containing a string
t
in the format of
HH:MM
, where
t(00:00≤t≤23:59)
, denoting the time shown on the clock.
Sample Input
1 .XX...XX.....XX...XX. X..X....X......X.X..X X..X....X.X....X.X..X ......XX.....XX...XX. X..X.X....X....X.X..X X..X.X.........X.X..X .XX...XX.....XX...XX.
Sample Output
02:38题意:看图说数、题目并不难 大多数参赛的队伍都做出来了 就是一个简单看图说数 可是我还是因为格式问题错了好几次。ac代码(代码可能写的有点麻烦 但易于理解):#include<bits/stdc++.h> using namespace std; #define maxn 10 #define maxm 24 char p[maxn][maxm];//开一个矩阵列表 用于存储图 int main() { int t; int a,b,c,d; scanf("%d",&t); int i=0; int h=t; while(t--) { i++; memset(p,0,sizeof(p)); if(t==h-1) getchar(); a=0,b=0,c=0,d=0; for(int i = 1; i<=7;i++) { for(int j=1;j<=21;j++) scanf("%c",&p[i][j]);//读入图 if(i!=7) getchar();//坑在这里 最后一行的输入不能再让getchar吃掉回车 否则第二张图读的时候会出错 } if(p[1][2]=='.')//判断第一个字 a=1; else if(p[2][1]=='.') a=2; else if(p[4][2]=='.'&&p[1][4]=='X') a=0; /*---------------------*///判断第三个字 if(p[2][16]=='.') c=5; else if(p[5][16]=='.') c=2; else if(p[1][14]=='.'&&p[2][13]=='X') c=4; else if(p[7][14]=='.') c=1; else if(p[4][14]=='.') c=0; else if(p[4][14]=='X'&&p[2][13]=='.') c=3; /*---------------------*///判断第二个字 if(p[2][9]=='.'&&p[5][6]=='.') b=5; else if(p[2][9]=='.'&&p[5][6]=='X') b=6; else if(p[1][7]=='.'&&p[4][7]=='.') b=1; else if(p[1][7]=='.'&&p[4][7]=='X') b=4; else if(p[7][7]=='.') b=7; else if(p[4][7]=='.') b=0; else if(p[5][9]=='.') b=2; else if(p[2][6]=='.'&&p[5][6]=='.') b=3; else if(p[5][6]=='.') b=9; else if (p[2][6]=='X'&&p[5][6]=='X') b=8; /*-----------------------*///判断第四个字 if(p[2][21]=='.'&&p[5][18]=='.') d=5; else if(p[2][21]=='.'&&p[5][18]=='X') d=6; else if(p[1][19]=='.'&&p[4][19]=='.') d=1; else if(p[1][19]=='.'&&p[4][19]=='X') d=4; else if(p[7][19]=='.') d=7; else if(p[4][19]=='.') d=0; else if(p[5][21]=='.') d=2; else if(p[2][18]=='.'&&p[5][18]=='.') d=3; else if(p[5][18]=='.') d=9; else if (p[2][18]=='X'&&p[5][18]=='X') d=8; printf("%d%d:%d%d\n",a,b,c,d); getchar();//吃掉回车 防止影响下次的读入 } return 0; }