Cod sursa(job #2777932)
Utilizator | Data | 26 septembrie 2021 13:11:23 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <fstream>
#include <cmath>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int main()
{
int x,i,n,u,p;
double j;
f>>n;
for(i=1;i<=n;i++)
{
f>>x;
u=0;
for(j=1;j<=x;j++)
{
p=pow(j,j);
u=u+p%10;
}
g<<u%10<<endl;
}
}