Cod sursa(job #636501)
| Utilizator | Data | 19 noiembrie 2011 20:50:38 | |
|---|---|---|---|
| Problema | Ciuperci | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | .com 2011 | Marime | 0.47 kb |
# include <fstream>
# define mod 666013
using namespace std;
ifstream f ("ciuperci.in");
ofstream g ("ciuperci.out");
long long int x;
int i,n;
long long int calc(long long int x)
{
if (x==0)
return 1;
if (x%2==1)
{
long long int y=(calc((x-1)/2))%mod;
return y*y;
}
else
return (2*calc((x-1)/2)*calc (x/2))%mod;
}
int main ()
{
f>>n;
for (i=1;i<=n;i++)
{
f>>x;
g<<(calc (x))%mod<<"\n";
}
return 0;
}
