Skip to content

Instantly share code, notes, and snippets.

@MohamedTaha98
Created July 24, 2017 21:37
Show Gist options
  • Save MohamedTaha98/e303d1a2d84c5aaa69632127525dfaab to your computer and use it in GitHub Desktop.
Save MohamedTaha98/e303d1a2d84c5aaa69632127525dfaab to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main () {
long n;
cin >> n;
long ar[n];
bool won = false;
for (int i = 0; i < n; i++)
cin >> ar[i];
for (int i = 0; i < n; i++) {
if (ar[i] % 2 == 0) {
if (won == true)
won = false;
else
won = true;
}
if (won == true)
cout << 1 << endl;
else
cout << 2 << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment