C++ 注意:若双方均无被夹吃,或双方均被夹吃,则为平局(而不是夹吃个数相等)
#include <array> #include <iostream> #include <vector> using namespace std; int main() { int t; cin >> t; while (t--) { array<array<char, 3>, 3> a; for (int i=2; i>-1; i--) { for (int j=2; j>-1; j--) { cin >> a[i][j]; } } int cnt_y=0, cnt_k=0; for (int i=2; i>-1; i--) { for (int j=2; j>-1; j--) { if (a[i][j]=='*') { if (i+1<3 && i-1>-1 && a[i+1][j]=='o' && a[i-1][j]=='o') { cnt_y++; } if (j+1<3 && j-1>-1 && a[i][j+1]=='o' && a[i][j-1]=='o') { cnt_y++; } } if (a[i][j]=='o') { if (i+1<3 && i-1>-1 && a[i+1][j]=='*' && a[i-1][j]=='*') { cnt_k++; } if (j+1<3 && j-1>-1 && a[i][j+1]=='*' && a[i][j-1]=='*') { cnt_k++; } } } } // cout << cnt_y << ' ' << cnt_k << endl; if (cnt_y>0 && cnt_k==0) cout << "yukari" << endl; else if (cnt_k>0 && cnt_y==0) cout << "kou" << endl; else cout << "draw" << endl; } } // 64 位输出请用 printf("%lld")