You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int i, x, p = 0, q = 0, r = 0, a[1111];
|
|
string s;
|
|
cin >> s; //读入
|
|
for (i = 0; i < s.size(); i++) {
|
|
x = int(s[i]) - 48;
|
|
a[x] = i % 2; //一维数组模拟
|
|
}
|
|
if (a[1] == a[5] && a[5] == a[9]) {
|
|
if (a[1] == 0) p = 1; else q = 1;
|
|
r = 1;
|
|
} //如同↘样的对角线
|
|
if (a[3] == a[5] && a[5] == a[7]) {
|
|
if (a[3] == 0) p = 1; else q = 1;
|
|
r = 1;
|
|
} //如图↙样的对角线(复制上面直接修改)
|
|
for (i = 1; i <= 3; i++)
|
|
if (a[i] == a[i + 3] && a[i + 3] == a[i + 6]) {
|
|
if (a[i] == 0) p = 1; else q = 1;
|
|
r = 1;
|
|
} //每列判断是否一致
|
|
for (i = 1; i <= 9; i += 3)
|
|
if (a[i] == a[i + 1] && a[i + 1] == a[i + 2]) {
|
|
if (a[i] == 0) p = 1; else q = 1;
|
|
r = 1;
|
|
} //每行判断是否一致
|
|
if (p && !q) cout << "xiaoa";
|
|
if (q) cout << "uim";
|
|
if (r) {
|
|
cout << " wins.";
|
|
return 0;
|
|
} //输出
|
|
cout << "drew.";
|
|
} |