Cod sursa(job #2169549)
| Utilizator | Data | 14 martie 2018 16:03:15 | |
|---|---|---|---|
| Problema | Factorial | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main() {
int p, m, cont, n;
f>>p;
n=4*p;
while(cont<p) {
cont=0;
m=n;
while(m!=0) {
m/=5;
cont+=m;
}
n++;
}
if(cont!=p){
g<<-1;
}
else if(p==0){
g<<1;
}
else{
g<<n-1;
}
return 0;
}
