Cod sursa(job #1195483)

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