,
2024-07-18 09:51:16
发布于:广东
#include<bits/stdc++.h>
using namespace std;
const int N = 15;
int a[N][N];
int z[N][N];
int main(){
int n;
cin >> n;
int i1,j1;
int b = 0;
for (int i = 0;i < n;i++){
for (int j = 0;j < n;j++){
cin >> a[i][j];
}
}
int sum1 = 0,sum2 = 0;
for (int i = 0;i < n;i++){
sum1 = 0;
sum2 = 0;
for (int j = 0;j < n;j++){
sum1 += a[i][j];
if (a[i][j] == 0){
z[i][j] = 1;
}
}
for (int j = 0;j < n;j++){
sum2 += a[j][i];
if (a[j][i] == 0){
z[j][i] = 1;
}
}
if (sum1 % 2 == 0 && sum2 % 2 == 0){
b = 1;
}
}
for (int i = 0;i < n;i++){
if (b == 1){
cout << "Let's go";
break;
}
else{
for (int j = 0;j < n;j++){
if (z[i][j] == 1){
a[i][j] = 1;
i1 = i;
j1 = j;
sum1 = 0;
sum2 = 0;
for (int k = 0;k < n;k++){
sum1 += a[i][j];
}
for (int k = 0;k < n;k++){
sum2 += a[j][i];
}
if (sum1 % 2 == 0 && sum2 % 2 == 0){
b = -1;
}
}else if (z[i][j] == 0){
a[i][j] = 0;
i1 = i;
j1 = j;
sum1 = 0;
sum2 = 0;
for (int k = 0;k < n;k++){
sum1 += a[i][j];
}
for (int k = 0;k < n;k++){
sum2 += a[j][i];
}
if (sum1 % 2 == 0 && sum2 % 2 == 0){
b = -1;
}
}
}
if (b == -1){
printf("Switch(%d,%d)",i1 - 1,j1 - 1);
break;
}else{
cout << "Another way";
}
}
}
return 0;
}
全部评论 4
wow wjy姐姐好强
2024-08-23 来自 广东
0?
2024-12-13 来自 广东
0
6666,你怎么换班了?
2024-07-28 来自 广东
0因为班主任UwU
每天二十分钟手机我任务都做不完2024-07-28 来自 广东
066
2024-07-29 来自 广东
0
谁把我踢了(相亲相爱一家人)?
2024-07-28 来自 广东
0你们1班都在干嘛
2024-07-22 来自 广东
0写代码
2024-07-22 来自 广东
0
有帮助,赞一个