Cod sursa(job #743056)

Utilizator mihai995mihai995 mihai995 Data 2 mai 2012 23:09:20
Problema Xerox Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.65 kb
#include <fstream>
using namespace std;

const int N = 20005;
char s[N];

ifstream in("xerox.in");
ofstream out("xerox.out");

inline bool cifra(char& c)
{
    return '0' <= c && c <= '9';
}

void get(int& x)
{
    int p = 0;

    in.getline(s, N);

    while (!cifra(s[p]))
        p++;

    x = 0;

    while (cifra(s[p]))
        x = x * 10 + s[p++] - '0';
}

bool work()
{
    int n, sum = 0, x;

    get(n);

    while (n--)
    {
        get(x);
        sum ^= x;
    }

    return sum != 0;
}

int main()
{
    int t;

    in >> t >> ws;

    while (t--)
        out << work() << "\n";

    return 0;
}