Cod sursa(job #1803638)
Utilizator | Data | 11 noiembrie 2016 17:24:13 | |
---|---|---|---|
Problema | Factorial | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include<fstream>
using namespace std;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
int n,p,x;
n = 1;
f>>p;
while(p > 0){
n++;
x = n;
while(x % 5 == 0){
p--;
x = x / 5;
}
}
if(p < 0)
g<<-1;
else
g<<n;
return 0;
}