Cod sursa(job #1386135)
Utilizator | Data | 12 martie 2015 18:35:22 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <iostream>
#include<fstream>
#include<math.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
unsigned int T,x,i=1;
char N;
f>>T;
while(i<=T)
{
unsigned int s=0;
f>>N;
x=int(N)-48;
for(unsigned int j=1;j<=x;j++)
s=s+pow(j,j);
g<<s%10<<endl;
i++;
}
return 0;
}