-
Notifications
You must be signed in to change notification settings - Fork 1
/
02082.cpp
46 lines (39 loc) · 1.09 KB
/
02082.cpp
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
#include <iostream>
#include <string>
#include <vector>
using namespace std;
string num[10][5] = {
{"###", "#.#", "#.#", "#.#", "###"},
{"..#", "..#", "..#", "..#", "..#"},
{"###", "..#", "###", "#..", "###"},
{"###", "..#", "###", "..#", "###"},
{"#.#", "#.#", "###", "..#", "..#"},
{"###", "#..", "###", "..#", "###"},
{"###", "#..", "###", "#.#", "###"},
{"###", "..#", "..#", "..#", "..#"},
{"###", "#.#", "###", "#.#", "###"},
{"###", "#.#", "###", "..#", "###"}
};
bool check(const vector<string> &d, int n) {
for (int i=0; i<5; i++) for (int j=0; j<3; j++) {
if (num[n][i][j] == '.' && d[i][j] == '#') return false;
}
return true;
}
int calc(const vector<string> &v, int n) {
vector<string> d(5);
for (int i=0; i<5; i++) d[i] = v[i].substr(n*4, 3);
for (int i=0; i<10; i++) if (check(d, i)) return i;
return -1;
}
void solve(void) {
vector<string> v(5);
for (int i=0; i<5; i++) getline(cin, v[i]);
cout << calc(v, 0) << calc(v, 1) << ":" << calc(v, 2) << calc(v, 3);
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}