Cod sursa(job #1295772)
Utilizator | Data | 20 decembrie 2014 10:25:25 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <math.h>
#include <fstream>
using namespace std;
int main()
{
ifstream f("cifra.in");
ofstream g("cifra.out");
int x,t,n,i,s;
f>>t;
i=1;
while(i<=t)
{
f>>n;
x=1;
s=0;
while(x<=n)
{s=s+pow(x,x);
x=x+1;
}
g<<s%10<<"\n";
i=i+1;
}
return 0;
}