Cod sursa(job #2442244)
Utilizator | Data | 23 iulie 2019 14:00:10 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
unsigned long long T,n,a,S=0,P,i,j;
ifstream f("cifra.in");
ofstream g("cifra.out");
int main()
{
f>>T;
while(f>>n)
{
S=0;
for(i=1;i<=n;i++)
{
S=S+pow(i,i);
S=S%10;
}
g<<S%10<<endl;
}
return 0;
}