Cod sursa(job #715356)
| Utilizator | Data | 17 martie 2012 01:47:19 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.32 kb |
#include<iostream>
#include<fstream>
#include<math.h>
using namespace std;
int main(){
ifstream f("cifra.in");
int n,x;
long long s;
f>>n;
ofstream g("cifra.out");
for(int i=1;i<=n;i++){
f>>x;
s=0;
for(int j=1;j<=x;j++)
s=s+pow(j,j);
g<<s%10<<endl;
}
f.close();
g.close();
return 0;
}