Cod sursa(job #2477509)
Utilizator | Data | 20 octombrie 2019 15:05:08 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ifstream f("fact.in");
ofstream g("fact.out");
ull n,nr,i;
int main()
{
f>>n;
if(n==0)
g<<1;
else{
i=5;
while(nr<n)
{ ull 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;
}