mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 705B_2.cpp
Another way to solve this problem.
This commit is contained in:
parent
102ea8ff02
commit
0f7916ddd9
36
Codeforces/705B_2.cpp
Normal file
36
Codeforces/705B_2.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
int tmp;
|
||||
int a0=0;
|
||||
int a1=0;
|
||||
int laststate=2;
|
||||
for(int i=0; i<n; i++)
|
||||
{
|
||||
scanf("%d",&tmp);
|
||||
if(tmp==1)
|
||||
{
|
||||
printf("%d\n",laststate);
|
||||
continue;
|
||||
}
|
||||
if(tmp%2==0) a0++;
|
||||
else a1++;
|
||||
if(a1%2==1)
|
||||
{
|
||||
laststate=2-((a0+a1)%2==0);
|
||||
printf("%d\n",laststate);
|
||||
}
|
||||
else
|
||||
{
|
||||
laststate=2-((a0+a1)%2==1);
|
||||
printf("%d\n",laststate);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user