Pagini recente » Cod sursa (job #1233865) | Cod sursa (job #2887063) | Cod sursa (job #2353310) | Cod sursa (job #2461755) | Cod sursa (job #905086)
Cod sursa(job #905086)
#include <fstream>
#include <iostream>
#include <math.h>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
unsigned long long t,i,j,a[100000000],s=0;
/*
long long putere(long long int x,long long y)
{
long long a=1;
while(y>0)
if(y%2==0)
{
x=(x*x);
y=y/2;
}
else
{
a=(a*x);
y--;
}
return a;
}
*/
int main()
{
f>>t;
for(i=1;i<=t;i++)
{
s=0;
f>>a[i];
for(j=1;j<=a[i];j++)
s=s+pow(j,j);
// cout<<s<<"\n";
g<<s%10<<"\n";
}
return 0;
}