Time To Get Up

题目链接

题意

用一个7*21的二维矩阵表示一个时间,要求输出时间。

思路

可以记录每条边是否出现,对于这样若干条边的集合记录数字是多少。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[33;1m" << #x << "->" ; err(x);} while (0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x){for (auto v: a) cout << v << ' '; err(x...);}
template<typename T, typename... A>
void err(T a, A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
#define inf 1ll << 50
char s[10][30];
const int up = 1 << 8;
int hack[up];
int check(int t)
{
int ans = 0;
if (s[0][t + 1] == 'X')
ans |= (1 << 1);
if (s[1][t + 3] == 'X')
ans |= (1 << 0);
if (s[1][t] == 'X')
ans |= (1 << 2);
if (s[3][t + 1] == 'X')
ans |= (1 << 3);
if (s[4][t] == 'X')
ans |= (1 << 6);
if (s[6][t + 1] == 'X')
ans |= (1 << 5);
if (s[4][t + 3] == 'X')
ans |= (1 << 4);
return hack[ans];
}
int main()
{
int T;
scanf("%d", &T);
hack[119] = 0;
hack[17] = 1;
hack[107] = 2;
hack[59] = 3;
hack[29] = 4;
hack[62] = 5;
hack[126] = 6;
hack[19] = 7;
hack[127] = 8;
hack[63] = 9;
while (T--)
{
for (int i = 0; i < 7; i++)
scanf("%s", s[i]);
printf("%d%d:%d%d\n", check(0), check(5), check(12), check(17));
}
return 0;
}

0%