Cod sursa(job #1116606)
Utilizator | Data | 22 februarie 2014 18:18:30 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<fstream>
using namespace std;
long long p,n=1,m=5,k,x,z,y;
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>p;
if(!p){fout<<1;return 0;}
do
{
x++;n=5*x;y=x;z=0;
while(!(y%5))y/=5,z++;
if(!z)k++;else
if(z==1)k+=2;else
if(z==2)k+=3;else
if(z==3)k+=4;else
if(z==4)k+=5;
}while(k!=p);
fout<<n;
return 0;
}