Pagini recente » Cod sursa (job #2457672) | Cod sursa (job #1698679) | Cod sursa (job #2842218) | Cod sursa (job #27990) | Cod sursa (job #199537)
Cod sursa(job #199537)
using namespace std;
#include <iostream>
#include <fstream>
int power(int x,int y){
int d=x;
while(y--)
x=(x*d)%10;
return x;
}
int cifra(long long n){
int s=0;
while(n--)
s = s + (power(n,n))%10;
return s;
}
int main()
{
int t;
long long n;
ifstream f("cifra.in");
ofstream g("cifra.out");
f>>t;
while(t--){
f>>n;
s%=10;
g<<s<<endl;
}
return 0;
}