Pagini recente » Cod sursa (job #1846269) | Cod sursa (job #335278) | Cod sursa (job #2745567) | Cod sursa (job #1862857) | Cod sursa (job #636193)
Cod sursa(job #636193)
#include <cstdio>
typedef long long i64;
inline i64 fct(i64 x)
{
if (x<2)
return 1;
if (x&(x-1)==0)
return 1;
else if (x&1)
{
i64 aux=fct(x>>1);
return (aux*aux)%666013;
}
else
return (2*fct(x>>1)*fct((x>>1)-1))%666013;
}
int main()
{
int t;
long long n;
freopen("ciuperci.in","r",stdin);
freopen("ciuperci.out","w",stdout);
scanf("%d",&t);
for (;t;--t)
{
scanf("%lld",&n);
printf("%lld\n",fct(n));
}
return 0;
}