-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1915B.cpp
More file actions
67 lines (54 loc) · 845 Bytes
/
Copy path1915B.cpp
File metadata and controls
67 lines (54 loc) · 845 Bytes
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
59
60
61
62
63
64
65
66
67
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--) {
char mat[3][3];
int r, c;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
cin >> mat[i][j];
if (mat[i][j] == '?') {
r = i;
c = j;
}
}
}
vector<char> v;
for (int i = 0; i < 3; i++) {
if (i == r) {
continue;
} else {
v.push_back(mat[i][c]);
}
}
for (int j = 0; j < 3; j++) {
if (j == c) {
continue;
} else {
v.push_back(mat[r][j]);
}
}
int a = 0, b = 0, cc = 0;
for (auto it : v) {
if (it == 'A') {
a++;
} else if (it == 'B') {
b++;
} else {
cc++;
}
}
if (a == 0) {
cout << 'A' << endl;
} else if (b == 0) {
cout << 'B' << endl;
} else if (cc == 0) {
cout << 'C' << endl;
}
}
return 0;
}