📄 1949.cpp
字号:
// 1949.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <fstream>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
ifstream cin("a.txt");
int a[100][100],i,x,y,n,h,l,hs,ls,hw,lw;
while(cin>>i)
{
ls=0;
hs=0;
if(i==0)break;
for(x=0;x<i;x++)
{
for(y=0;y<i;y++)
{
cin>>n;
a[x][y]=n;
}
}
for(x=0;x<i;x++)
{
h=0;
for(y=0;y<i;y++)
{
if(a[x][y]==1)
h++;
}
if(h%2==1)
{
hs++;
hw=x+1;
}
}
if(hs>1)
{
cout<<"Corrupt"<<endl;
continue;
}
for(x=0;x<i;x++)
{
l=0;
for(y=0;y<i;y++)
{
if(a[y][x]==1)
l++;
}
if(l%2==1)
{
ls++;
lw=x+1;
}
}
if(ls>1)
{
cout<<"Corrupt"<<endl;
continue;
}
if(ls==1&&hs==1)
cout<<"Change bit ("<<hw<<","<<lw<<")"<<endl;
else
cout<<"OK"<<endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -