Cod sursa(job #699561)
Utilizator | lupu flaviu flaviu.stefan | Data | 29 februarie 2012 20:08:35 |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#include<iostream.h>
#include<fstream>
#include<math.h>
#include<time.h>
using namespace std;
ifstream g("cifra.in");
ofstream f("cifrea.out");
double start ,stop;
int n,x[30000];
int main ()
{
start=clock();
int i;
g>>n;
for(i=0;i<n;i++)
{ g>>x[i]; }
int p=0 ,j,s=0;
for(i=0;i<n;i++)
{
for(j=1;j<x[i]+1;j++)
{
p=pow(j,j);
s+=p;
}
f<<s%10<<'\n';
p=0;
j=0;
s=0;
}
stop=clock();
cout<<"Timp de executie :"<<(stop-start)/CLOCKS_PER_SEC;
f.close();
g.close();
return 0;
}