d0662792
Rating
-
Bài tập
3
Điểm
1619
Rating #
-
Điểm #
16964
Giới thiệu
include <bits/stdc++.h>
define ll long long
define nmax (long long)(1e6+7)
define oo (long long)1e18
define pii pair <ll, ll>
define fi first
define se second
define pro "keo"
ll n, a[nmax];
using namespace std;
bool check(ll k) {
ll keo = n, v = 0, p = 0;
while (keo>0) {
if(keo<k){
v += keo;
keo = 0;
}
else{
v += k;
keo -= k;
}
p += keo/10;
keo -= keo/10;
}
return (v>=n/2);
}
int main()
{
if (fopen(pro".inp","r")){
freopen(pro".inp","r",stdin);
freopen(pro".out","w",stdout);
}
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n;
ll L = 1, R = n, res = 0;
while (L<=R) {
ll mid = (L+R)/2;
if (check(mid)) {
res = mid;
R = mid - 1;
}
else L = mid + 1;
}
cout << res;
return 0;
}