Matrix Game

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;

    cout << "Enter Number of Row : ";
    cin >> n;

    cout << "Enter Number of Column : ";
    cin >> m;

    int v[n][m], xor_sum = 0;

    cout << "Enter Each Column Stone : \n";
    for(int i=0; i<n; i++)
    {
        int sum = 0;
        for(int j=0; j<m; j++)
        {
            cin >> v[i][j];
            sum += v[i][j];
        }

        xor_sum ^= sum;
    }

    if(xor_sum > 0)
        cout << "First Player Win." << "\n";
    else
        cout << "Second Player Win." << "\n";

    return 0;
}

Comments