Cod sursa(job #2372634)
Utilizator | Data | 7 martie 2019 10:21:13 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.27 kb |
#include <iostream>
#include <fstream>
using namespace std;
long long int p,x,z,y;
int main()
{ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
x=0;
z=0;
while(z<p){x=x+5;y=x;
while(y%5==0) {z++;y=y/5;}}
if(p==0) g<<1;
else {if(p==z) g<<x;
else g<<-1;
}
}