Cod sursa(job #999462)
Utilizator | Data | 20 septembrie 2013 15:07:02 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
//Bucaciuc Andrei
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int t,n;
ifstream in ("cifra.in");
ofstream out ("cifra.out");
void print(){
long int s;
int i;
in>>t;
while(t > 0){
in>>n;
s=0;
for(i=1; i<=n; i++)
s=pow(i,i)+s;
out<<s%10<<"\n";
t--;
}
}
int main()
{
print();
cout<<"\n";
return 0;
}