Cod sursa(job #1915857)
| Utilizator | Data | 8 martie 2017 22:49:31 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
int main()
{
ifstream f ("cifra.in");
ofstream g ("cifra.out");
int t,n,i,j,m=0,c=0;
f>>t;
while (t>0)
{ f>>n;
for (j=c+1;j<=n;j++)
m+=pow(j,j);
g<<m%10<<endl;
t--;
c=n;
}
f.close();
g.close();
return 0;
}
