Cod sursa(job #1930330)
Utilizator | Data | 18 martie 2017 19:09:02 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include<string.h>
#include<fstream>
#include<math.h>
#include<stdlib.h>
using namespace std;
int main()
{ifstream f("cifra.in");
ofstream g("cifra.out");
int p, s=0, i, j;
char n[100];
long int val;
f>>p;
for(i=1;i<=p;i++){
f.get(n,10);
val=atoi(n);
for(j=1;j<=val;j++)s+=pow(j,j);
g<<s%10<<endl;
}
f.close();
g.close();
return 0;
}