Cod sursa(job #798991)
Utilizator | Data | 17 octombrie 2012 18:33:30 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
#include<iostream>
#include<math.h>
#include<fstream>
using namespace std;
int main() {
double t[1000],k,n,s=0;
ifstream f("cifra.in");
ofstream g("cifra.out");
f >> n;
for(int i=0;i<n;i++) {
f >> t[i];
}
for(int i=0;i<n;i++) {
s=0;
for(int j=1;j<=t[i];j++) {
k = pow( j , j);
s=s+k;
}
g << (int)s%10 << endl;
}
}