Cod sursa(job #1188919)
Utilizator | Data | 20 mai 2014 19:55:34 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
long long int n,p,i,nr,ok,k,y,x;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
while(k<p)
{
i++;
if(i%5==0)
{
y=i;
if(y%5==0){while(y/5!=0){y=y/5;k++;}}
}
}
if(k>p)cout<<"-1";
else cout<<i;
return 0;
}