본문 바로가기

Solutions/Dlbo's Solution

PKU 2260. Error Correction. AC get -_-

#include 

using namespace std;

int main()
{
	int n, horsum, versum, horcnt, vercnt, i, j, x[100][100], cx, cy;
	while (cin >> n)
	{
		horcnt = 0;
		vercnt = 0;
		if (!n)
		{
			break;
		}

		for (i = 0; i < n; i++)
		{
			horsum = 0;
			for (j = 0; j < n; j++)
			{
				cin >> x[i][j];
				horsum = x[i][j] + horsum;
			}

			if (horsum % 2 != 0)
			{
				cx = i;
				horcnt++;
			}
		}

		if (horcnt >= 2)
		{
			cout << "Corrupt" << endl;
			continue;
		}

		for (j = 0; j < n; j++)
		{
			versum = 0;
			for (i = 0; i < n; i++)
			{
				versum = versum + x[i][j];
			}

			if (versum % 2 != 0)
			{
				cy = j;
				vercnt++;
			}
		}

		if (vercnt >= 2)
		{
			cout << "Corrupt" << endl;
			continue;
		}

		if (horcnt == 0 && vercnt == 0)
		{
			cout << "OK" << endl;
		}
		else
		{
			cout << "Change bit (" << cx + 1 << "," << cy + 1 << ")" << endl;
		}
	}

	return 0;
}

이게 바로 무컴파일 AC -_-

'Solutions > Dlbo's Solution' 카테고리의 다른 글

PKU 3032. Card Trick. AC get -_-  (2) 2010.12.24
PKU 3176. Cow bowling. AC get -_-  (0) 2010.11.02
PKU 3085. Quick Change. AC get -_-  (0) 2010.10.28
PKU 1422. Air Raid. AC get!  (0) 2010.06.24
PKU 1422. Air raid. WA -_-....  (2) 2010.06.23