Cod sursa(job #1156650)

Utilizator gabrielinelusGabriel-Robert Inelus gabrielinelus Data 27 martie 2014 20:27:52
Problema Felinare Scor 0
Compilator cpp Status done
Runda oni_11_12_6 Marime 0.48 kb
#include <cstdio>

using namespace std;
int N;
void NIM()
{
    int solutie = 0,x;
    for(int i = 1; i <= N; ++i)
        for(int j = 1; j <= N; ++j)
        {
            scanf("%d",&x);
            if(i == j) solutie ^= x;
        }
    printf("%d\n",2-(solutie != 0));
}

int main()
{
    freopen("joc5.in","r",stdin);
    freopen("joc5.out","w",stdout);

    scanf("%d",&N);
    do{
        NIM();
        scanf("%d",&N);
    }while(N);

    return 0;
}