Cod sursa(job #36105)
Utilizator | Data | 22 martie 2007 23:25:56 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.25 kb |
#include <fstream.h>
#include <math.h>
int main(){
long a,k,s,i;
ifstream f("cifra.in");
ofstream g("cifra.out");
f>>k;
while(k){
f>>a;s=0;
for(i=1;i<=a;i++){
s+=pow(i%10,i);
s%=10;
}
g<<s<<endl;
k--;
}
return 0;
}