-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path133.cpp
More file actions
104 lines (97 loc) · 2.56 KB
/
Copy path133.cpp
File metadata and controls
104 lines (97 loc) · 2.56 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <bits/stdc++.h>
using namespace std;
bool func1(vector<vector<char>>& chessBox,char target)
{
if(chessBox[0][0]==target&&chessBox[2][2]==target) return true;
if(chessBox[1][0]==target&&chessBox[1][2]==target) return true;
if(chessBox[2][0]==target&&chessBox[0][2]==target) return true;
if(chessBox[0][1]==target&&chessBox[2][1]==target) return true;
return false;
}
bool func2(vector<vector<char>>& chessBox,char target,int x)
{
if(chessBox[x][0]==target&&chessBox[x][2]==target) return true;
return false;
}
bool func3(vector<vector<char>>& chessBox,char target,int y)
{
if(chessBox[0][y]==target&&chessBox[2][y]==target) return true;
return false;
}
int main()
{
int t;
cin>>t;
vector<vector<char>> chessBox(3,vector<char>(3));
while(t--)
{
for(int i = 0;i<3;i++)
{
for(int j = 0;j<3;j++)
{
cin >> chessBox[i][j];
}
}
bool red = false;
bool purple = false;
if(chessBox[1][1]!='.')
{
if(chessBox[1][1]=='o')
{
if(func1(chessBox,'*')) red = true;
}
if(chessBox[1][1]=='*')
{
if(func1(chessBox,'o')) purple = true;
}
}
if(chessBox[1][0]!='.')
{
if(chessBox[1][0]=='o')
{
if(func3(chessBox,'*',0)) red = true;
}
if(chessBox[1][0]=='*')
{
if(func3(chessBox,'o',0)) purple = true;
}
}
if(chessBox[1][2]!='.')
{
if(chessBox[1][2]=='o')
{
if(func3(chessBox,'*',2)) red = true;
}
if(chessBox[1][2]=='*')
{
if(func3(chessBox,'o',2)) purple = true;
}
}
if(chessBox[0][1]!='.')
{
if(chessBox[0][1]=='o')
{
if(func2(chessBox,'*',0)) red = true;
}
if(chessBox[0][1]=='*')
{
if(func2(chessBox,'o',0)) purple = true;
}
}
if(chessBox[2][1]!='.')
{
if(chessBox[2][1]=='o')
{
if(func2(chessBox,'*',2)) red = true;
}
if(chessBox[2][1]=='*')
{
if(func2(chessBox,'o',2)) purple = true;
}
}
if(red&&!purple) cout<<"kou"<<endl;
else if(!red&&purple) cout<<"yukan"<<endl;
else cout<<"draw"<<endl;
}
return 0;
}