Cod sursa(job #201597)

Utilizator cristideluClaudiu Antonovici cristidelu Data 1 august 2008 19:48:49
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.36 kb
#include <iostream.h>
#include <fstream.h>
#include <math.h>
ifstream f;
ofstream g;
int t;
unsigned long n;

int cif(unsigned long x)
{unsigned long s=0;
for (int i=1;i<=x;i++)
s+=pow(i,i);
return s%10;}

int main()
{f.open("cifra.in");
g.open("cifra.out");

f>>t;
for (int i=1;i<=t;i++)
{f>>n;
g<<cif(n)<<endl;}
f.close();
g.close();
return 0;}