Cod sursa(job #2477512)
| Utilizator | Data | 20 octombrie 2019 15:10:52 | |
|---|---|---|---|
| Problema | Factorial | Scor | 35 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int n,nr,i;
int main()
{
f>>n;
if(n==0)
g<<1;
else{
i=5;
while(nr<n)
{ int x=0,y;
y=i;
while(y%5==0){
x++;
y/=5;
}
nr=nr+x;
i+=5;
}
if(nr==n)
g<<i-5;
else g<<-1;
}
return 0;
}
