Cod sursa(job #947914)
| Utilizator | Data | 8 mai 2013 20:22:53 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<iostream>
#include<fstream>
#include<math.h>
using namespace std;
int main()
{int n,i,j,s,c,t;
ifstream f("cifra.in");
ofstream g("cifra.out");
f>>n;
cout<<n;
for(i=1;i<=n;i++)
{f>>t;
s=0;
for(j=1;j<=t;j++)
{c=pow(j,j);
s=s+(c%10);
}
g<<s%10<<endl;
}
f.close();
g.close();
}
