Untitled
unknown
c_cpp
4 years ago
429 B
13
Indexable
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
map<ll,bool> check;
ll t=1;
int i=2;
while (t<=(ll)pow(10,18))
{
t*=i;
check[t]=true;
i++;
}
int n;
cin>>n;
while (n--)
{
ll x;
cin>>x;
if (x==1) cout<<2;
else
if (check[x]) cout<<1;
else cout<<0;
cout<<'\n';
}
return 0;
}
Editor is loading...