Cod sursa(job #16856)
Utilizator | Data | 14 februarie 2007 11:52:10 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
using namespace std;
#include<fstream>
int main(){
ifstream f("fact.in");
ofstream g("fact.out");
long long a, c, p, b, r, s;
f>>p;
a=4*p+1;
b=a/5;
c=a-5*b;
if (c!=0) a=a+5-c;
s=0;
while (s==0){
c=5;
r=0;
while (c<=a){
r=r+a/c;
c=c*5;
}
if (r>p) {g<<"-1"; s=1;}
else
if (r==p) { g<<a; s=1;}
a=a+5;
}
return 0;
}