#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout << "Enter Number of Square : ";
cin >> n;
vector<int>indx, v(n+1);
indx.push_back(0); /// for handling odd number of 1
cout << "Enter Each Square Coin is Place or Not : ";
for(int i=1;i<=n;i++) ///if coin place give value 1 otherwise 0
{
cin >> v[i];
if(v[i] == 1)
indx.push_back(i);
}
int xor_sum = 0;
for(int i=indx.size()-1; i>=1; i-=2)
{
int d = indx[i] - indx[i-1] - 1;
xor_sum ^= d;
}
if(xor_sum > 0)
cout << "First Player Win." << "\n";
else
cout << "Second Player Win." << "\n";
return 0;
}
Comments
Post a Comment