Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int T,G,n;
- cin>>T>>G;
- while(G--)
- {
- cin>>n;
- int p=0;
- while(n%2==0)
- ++p,n/=2;
- if(T==1)
- if(p%2)
- cout<<0<<'\n';
- else
- cout<<1<<'\n';
- else
- if((n==1&&p%2)||(n>=3&&p%2==0))
- cout<<1<<'\n';
- else
- cout<<0<<'\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement