问题 K: Time To Get Up
时间限制: 2 Sec 内存限制: 128 MB题目描述
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.
输入
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.
输出
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.
样例输入
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.
样例输出
02:38
#include<bits/stdc++.h>
using namespace std;
int main()
{
char q[7][22];
int t,i,j,a[22];
scanf("%d",&t);
//getchar();
while(t--)
{
memset(a,0,sizeof(a));
for(i=0;i<7;i++)
{
scanf("%s",q[i]);
}
for(j=0;j<4;j++)
for(i=0;i<7;i++)
{
if(q[i][j]=='X')
a[j]++;
}
for(j=5;j<9;j++)
for(i=0;i<7;i++)
{
if(q[i][j]=='X')
a[j]++;
}
for(j=12;j<16;j++)
for(i=0;i<7;i++)
{
if(q[i][j]=='X')
a[j]++;
}
for(j=17;j<21;j++)
for(i=0;i<7;i++)
{
if(q[i][j]=='X')
a[j]++;
}
if(a[0]==4&&a[1]==2&&a[2]==2&&a[3]==4)
printf("0");
if(a[0]==0&&a[1]==0&&a[2]==0&&a[3]==4)
printf("1");
if(a[0]==2&&a[1]==3&&a[2]==3&&a[3]==2&&q[4][0]=='X')
printf("2");
/*if(a[0]==0&&a[1]==3&&a[2]==3&&a[3]==4)
printf("3");
if(a[0]==2&&a[1]==1&&a[2]==1&&a[3]==4)
printf("4");
if(a[0]==2&&a[1]==3&&a[2]==3&&a[3]==2&&q[1][0]=='X')
printf("5");
if(a[0]==4&&a[1]==3&&a[2]==3&&a[3]==2)
printf("6");
if(a[0]==0&&a[1]==1&&a[2]==1&&a[3]==4)
printf("7");
if(a[0]==4&&a[1]==3&&a[2]==3&&a[3]==4)
printf("8");
if(a[0]==2&&a[1]==3&&a[2]==3&&a[3]==4)
printf("9");*/
if(a[5]==4&&a[6]==2&&a[7]==2&&a[8]==4)
printf("0");
if(a[5]==0&&a[6]==0&&a[7]==0&&a[8]==4)
printf("1");
if(a[5]==2&&a[6]==3&&a[7]==3&&a[8]==2&&q[4][5]=='X')
printf("2");
if(a[5]==0&&a[6]==3&&a[7]==3&&a[8]==4)
printf("3");
if(a[5]==2&&a[6]==1&&a[7]==1&&a[8]==4)
printf("4");
if(a[5]==2&&a[6]==3&&a[7]==3&&a[8]==2&&q[1][5]=='X')
printf("5");
if(a[5]==4&&a[6]==3&&a[7]==3&&a[8]==2)
printf("6");
if(a[5]==0&&a[6]==1&&a[7]==1&&a[8]==4)
printf("7");
if(a[5]==4&&a[6]==3&&a[7]==3&&a[8]==4)
printf("8");
if(a[5]==2&&a[6]==3&&a[7]==3&&a[8]==4)
printf("9");
printf(":");
if(a[12]==4&&a[13]==2&&a[14]==2&&a[15]==4)
printf("0");
if(a[12]==0&&a[13]==0&&a[14]==0&&a[15]==4)
printf("1");
if(a[12]==2&&a[13]==3&&a[14]==3&&a[15]==2&&q[4][12]=='X')
printf("2");
if(a[12]==0&&a[13]==3&&a[14]==3&&a[15]==4)
printf("3");
if(a[12]==2&&a[13]==1&&a[14]==1&&a[15]==4)
printf("4");
if(a[12]==2&&a[13]==3&&a[14]==3&&a[15]==2&&q[1][12]=='X')
printf("5");
/*if(a[12]==4&&a[13]==3&&a[14]==3&&a[15]==2)
printf("6");
if(a[12]==0&&a[13]==1&&a[14]==1&&a[15]==4)
printf("7");
if(a[12]==4&&a[13]==3&&a[14]==3&&a[15]==4)
printf("8");
if(a[12]==2&&a[13]==3&&a[14]==3&&a[15]==4)
printf("9");*/
if(a[17]==4&&a[18]==2&&a[19]==2&&a[20]==4)
printf("0");
if(a[17]==0&&a[18]==0&&a[19]==0&&a[20]==4)
printf("1");
if(a[17]==2&&a[18]==3&&a[19]==3&&a[20]==2&&q[4][17]=='X')
printf("2");
if(a[17]==0&&a[18]==3&&a[19]==3&&a[20]==4)
printf("3");
if(a[17]==2&&a[18]==1&&a[19]==1&&a[20]==4)
printf("4");
if(a[17]==2&&a[18]==3&&a[19]==3&&a[20]==2&&q[1][17]=='X')
printf("5");
if(a[17]==4&&a[18]==3&&a[19]==3&&a[20]==2)
printf("6");
if(a[17]==0&&a[18]==1&&a[19]==1&&a[20]==4)
printf("7");
if(a[17]==4&&a[18]==3&&a[19]==3&&a[20]==4)
printf("8");
if(a[17]==2&&a[18]==3&&a[19]==3&&a[20]==4)
printf("9");
printf("\n");
}
return 0;
}