Cod sursa(job #945751)
Utilizator | Data | 2 mai 2013 20:31:22 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
long long int t,v[30000],i,s=0,j;
ifstream f("cifra.in");
ofstream g("cifra.out");
f>>t;
for(i=1;i<=t;i++)
f>>v[i];
for(i=1;i<=t;i++)
{
s=0;
for(j=1;j<=v[i];j++)
{
s=s+pow(j,j);
}
g<<s%10<<endl;
}
f.close();
g.close();
return 0;
}