Cod sursa(job #1195590)

Utilizator crisana stanescu cris Data 7 iunie 2014 23:48:26
Problema Factorial Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.33 kb
#include <iostream>
#include <fstream>
using namespace std;
int main()
{int long N,P,x,t;
ifstream f("fact.in");
ofstream g("fact.out");
f>>P;
x=0;
N=1;
while (x<P)
{t=N;
while (t>0)
{if (t%5==0) {x=x+1;
             t=t/5;}
else t=0;}
N=N+1;}
if (x==P) g<<N-1;
if (x>P) g<< -1;
f.close();
g.close();
return 0;
}