Cod sursa(job #672913)
| Utilizator | Data | 3 februarie 2012 14:04:11 | |
|---|---|---|---|
| Problema | Factorial | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<iostream>
#include<fstream>
#include<time.h>
using namespace std;
int p,i,n,n5,aux,j;
int main()
{int t1,t2;
t1=clock();
ifstream g("fact.in");
g>>p;
i=1;
while(n5<p)
{aux=i*5; n=aux;
while(aux%5==0)
{n5++;
aux/=5;}
i++;}
ofstream t("fact.out");
if(i-1==0)
t<<1;
else
t<<n;
t.close();
g.close();
t2=clock();
cout<<(double)(t2-t1)/CLOCKS_PER_SEC;
return 0;}
