#19506: 請問這題如何0ms?


089487 (089487)


可以教一下嗎?

#28258: Re:請問這題如何0ms?


11035043@mail.hpsh.tp.edu.tw (和平110級李均笙)


可以教一下嗎?


恩~~

#include <iostream>
 using namespace std;
 int main () {
 int n,j,i;
 while(cin>>n){
 int o[101][101],r[101]={0},l[101]={0},h=0,e=0,a,b;
 for(i=1;i<=n;i++){
 for(j=1;j<=n;j++){
 cin>>o[i][j];
 l[i]+=o[i][j];
 r[j]+=o[i][j];
 }
 }
 for(i=1;i<=n;i++){
 if(l[i]%2!=0) {
 h++;
 a=i;
 }
 }
 for(j=1;j<=n;j++){
 if(r[j]%2!=0) {
 e++;
 b=j;
 }
 }
 if(e==0 && h==0) cout<<"OK"<<endl;
 else if(e+h>=2 && e-h>=2 || h-e>=2) cout<<"Corrupt"<<endl;
 else if(e+h==2 && e*h!=0) cout<<"Change bit ("<<a<<","<<b<<")"<<endl;
 }
 return 0;
 }

哈哈哈~對我甘拜下風吧