HDU 6077 17多校4 Time To Get Up 水题

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.

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.

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

题意:把字符串翻译成时间。

题解:直接利用他们的区别判断即可。

 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 }
时间: 2024-10-10 10:58:52

HDU 6077 17多校4 Time To Get Up 水题的相关文章

HDU 6124 17多校7 Euler theorem(简单思维题)

Problem Description HazelFan is given two positive integers a,b, and he wants to calculate amodb. But now he forgets the value of b and only remember the value of a, please tell him the number of different possible results. Input The first line conta

HDU 6059 17多校3 Kanade&#39;s trio(字典树)

Problem Description Give you an array A[1..n],you need to calculate how many tuples (i,j,k) satisfy that (i<j<k) and ((A[i] xor A[j])<(A[j] xor A[k])) There are T test cases. 1≤T≤20 1≤∑n≤5∗105 0≤A[i]<230 Input There is only one integer T on fi

HDU 6045 17多校2 Is Derek lying?

题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6045 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 687    Accepted Submission(s): 389 Problem Description Derek and Alfia are good friends.Derek 

HDU 6090 17多校5 Rikka with Graph(思维简单题)

Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: For an undirected graph G with n nodes and m edges, we can define the distance between 

HDU 6060 17多校3 RXD and dividing(树+dfs)

Problem Description RXD has a tree T, with the size of n. Each edge has a cost.Define f(S) as the the cost of the minimal Steiner Tree of the set S on tree T. he wants to divide 2,3,4,5,6,…n into k parts S1,S2,S3,…Sk,where ?Si={2,3,…,n} and for all d

HDU 6055 17多校 Regular polygon(计算几何)

Problem Description On a two-dimensional plane, give you n integer points. Your task is to figure out how many different regular polygon these points can make. Input The input file consists of several test cases. Each case the first line is a numbers

HDU 6047 17多校 Maximum Sequence(优先队列)

Problem Description Steph is extremely obsessed with "sequence problems" that are usually seen on magazines: Given the sequence 11, 23, 30, 35, what is the next number? Steph always finds them too easy for such a genius like himself until one da

HDU 6050 17多校2 Funny Function(数学+乘法逆元)

Problem Description Function Fx,ysatisfies:For given integers N and M,calculate Fm,1 modulo 1e9+7. Input There is one integer T in the first line.The next T lines,each line includes two integers N and M .1<=T<=10000,1<=N,M<2^63. Output For eac

HDU 6092 17多校5 Rikka with Subset(dp+思维)

Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: Yuta has n positive A1−An and their sum is m. Then for each subset S of A, Yuta calcula