Cod sursa(job #2630730)
Utilizator | Data | 26 iunie 2020 22:07:50 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <fstream>
#include <cmath>
#include <stdlib.h>
using namespace std;
long t,sum,i,x,y;
char s[256];
ifstream f("cifra.in");
ofstream g("cifra.out");
int main()
{
for(f>>t,i=1;i<=t;i++)
{
f>>s; x=atol(s); sum=0;
for(int j=1;j<=x;j++)
{
y=(long) pow(j,j);
sum+=y;
}
g<<sum%10<<endl;
}
f.close(); g.close();
}