Cod sursa(job #138543)
| Utilizator | Data | 18 februarie 2008 20:12:28 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.36 kb |
#include<fstream.h>
#include<iostream.h>
#include<math.h>
int main()
{
long i,n,x=0,v[30000],j;
int k
fstream f("cifra.in",ios::in);
f>>k;
for(i=1;i<=k;i++)
{
f>>n;
for(j=1;j<=n;j++)
{
x=x+pow(j%10,j);
x=x%10;
}
v[i]=x;
x=0;
}
f.close();
fstream g("cifra.out",ios::out);
for(i=1;i<=k;i++)
g<<v[i]<<endl;
g.close();
}