Cod sursa(job #249032)
Utilizator | Data | 27 ianuarie 2009 13:01:15 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.28 kb |
#include <fstream.h>
#include <math.h>
ifstream f("cifra.in");
ofstream g("cifra.out");
int main()
{ long unsigned T,N;unsigned s,i,j;
f>>T;
for(i=1;i<=T;i++) {f>>N;s=0;
for(j=1;j<=N;j++) s=s+(j%10*j%10);if(s>9) s=s%10;
g<<s<<"\n";}
return 0;
f.close();g.close();
}