Cod sursa(job #905086)
| Utilizator | Data | 5 martie 2013 15:33:09 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.62 kb |
#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;
}
