Nu aveti permisiuni pentru a descarca fisierul grader_test3.in
Cod sursa(job #2609310)
| Utilizator | Data | 2 mai 2020 13:42:58 | |
|---|---|---|---|
| Problema | Factorial | Scor | 85 |
| Compilator | cpp-64 | Status | done |
| Runda | igorj_mentorat1 | Marime | 0.48 kb |
#include<fstream>
#include<cmath>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
long long a,st,dr,n,m,p;
long long zero(long long n)
{
long long x=0;
while(n)
{
x=x+n/5;
n=n/5;
}
return x;
}
int main()
{
f>>n;
st=1;
dr=pow(10,24);
while(st<=dr)
{
m=(st+dr)/2;
a=zero(m);
if(a<n)
st=m+1;
else
{
if(n==a)
p=m;
dr=m-1;
}
}
g<<p;
return 0;
}
