Time To Get Up
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 277 Accepted Submission(s): 227
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.
![](https://i-blog.csdnimg.cn/blog_migrate/a75da662d165a599c0b132848db44fc5.jpeg)
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
Source
就是一条挺傻逼的模拟 然而当时多校还写错了一个地方wa了一发.....
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;
#define FIN freopen("input.txt","r",stdin);
#define FOUT freopen("output.txt","w",stdout);
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
typedef long long LL;
typedef pair<int, int> PII;
char mp[10][30];
int judge(int a, int b, int c, int d, int e, int f, int g) {
if(a == 1 && b == 1 && c == 1 && d == 0 && e == 1 && f == 1 && g == 1) return 0;
else if(a == 0 && b == 0 && c == 1 && d == 0 && e == 0 && f == 0 && g == 1) return 1;
else if(a == 0 && b == 1 && c == 1 && d == 1 && e == 1 && f == 1 && g == 0) return 2;
else if(a == 0 && b == 1 && c == 1 && d == 1 && e == 0 && f == 1 && g == 1) return 3;
else if(a == 1 && b == 0 && c == 1 && d == 1 && e == 0 && f == 0 && g == 1) return 4;
else if(a == 1 && b == 1 && c == 0 && d == 1 && e == 0 && f == 1 && g == 1) return 5;
else if(a == 1 && b == 1 && c == 0 && d == 1 && e == 1 && f == 1 && g == 1) return 6;
else if(a == 0 && b == 1 && c == 1 && d == 0 && e == 0 && f == 0 && g == 1) return 7;
else if(a == 1 && b == 1 && c == 1 && d == 1 && e == 1 && f == 1 && g == 1) return 8;
else if(a == 1 && b == 1 && c == 1 && d == 1 && e == 0 && f == 1 && g == 1) return 9;
}
int main() {
//FIN
int T;
scanf("%d", &T);
while(T--) {
for(int i = 0; i < 7; i++) scanf("%s", mp[i]);
//for(int i = 0; i < 7; i++) cout << mp[i] <<endl;
int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
if(mp[1][0] == 'X') a = 1;
if(mp[0][1] == 'X') b = 1;
if(mp[1][3] == 'X') c = 1;
if(mp[3][1] == 'X') d = 1;
if(mp[4][0] == 'X') e = 1;
if(mp[6][1] == 'X') f = 1;
if(mp[4][3] == 'X') g = 1;
int ans1 = judge(a, b, c, d, e, f, g);
a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
if(mp[1][5] == 'X') a = 1;
if(mp[0][7] == 'X') b = 1;
if(mp[1][8] == 'X') c = 1;
if(mp[3][7] == 'X') d = 1;
if(mp[4][5] == 'X') e = 1;
if(mp[6][7] == 'X') f = 1;
if(mp[4][8] == 'X') g = 1;
//cout << mp[1][9] <<endl;
int ans2 = judge(a, b, c, d, e, f, g);
//cout << a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f<<" "<<g<<endl;
//cout << ans2<<endl;
a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
if(mp[1][12] == 'X') a = 1;
if(mp[0][14] == 'X') b = 1;
if(mp[1][15] == 'X') c = 1;
if(mp[3][14] == 'X') d = 1;
if(mp[4][12] == 'X') e = 1;
if(mp[6][14] == 'X') f = 1;
if(mp[4][15] == 'X') g = 1;
int ans3 = judge(a, b, c, d, e, f, g);
a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
if(mp[1][17] == 'X') a = 1;
if(mp[0][19] == 'X') b = 1;
if(mp[1][20] == 'X') c = 1;
if(mp[3][19] == 'X') d = 1;
if(mp[4][17] == 'X') e = 1;
if(mp[6][19] == 'X') f = 1;
if(mp[4][20] == 'X') g = 1;
int ans4 = judge(a, b, c, d, e, f, g);
printf("%d%d:%d%d\n", ans1, ans2, ans3, ans4);
}
return 0;
}