Cod sursa(job #2095662)
| Utilizator | Data | 27 decembrie 2017 22:56:59 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("cifra.in");
ofstream fout("cifra.out");
int pow(int n,int x)
{
unsigned long long index=1;
while(x)
{
index=index*n;
x--;
}
return index;
}
int main()
{
unsigned long long n,x,index=0;
fin>>n;
while(n)
{
fin>>x;
index=index+pow(x,x);
fout<<index%10<<"\n";
n--;
}
fin.close();
fout.close();
return 0;
}
