Cod sursa(job #2757877)
| Utilizator | Data | 7 iunie 2021 08:06:46 | |
|---|---|---|---|
| Problema | Factorial | Scor | 90 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream>
#include <fstream>
#define int long long
using namespace std;
int beibi(int x)
{
int cnt=0;
while(x>0)
{
cnt+=x/5;
x=x/5;
}
return cnt;
}
signed main()
{
ifstream cin ("fact.in");
ofstream cout("fact.out");
int n, st=0, dr=100000000000000, mid;
cin>>n;
while(dr-st>1)
{
mid=(st+dr)/2;
if(beibi(mid)<n)
st=mid;
else
dr=mid;
}
cout<<dr;
return 0;
}
