• LQDOJ
  • Trang chủ
  • Bài tập
  • Bài nộp
  • Thành viên
  • Kỳ thi
  • Nhóm
  • Giới thiệu
    • Máy chấm
    • Khóa học
    • Đề xuất ý tưởng
    • Đề xuất bài tập
    • Tools
    • Báo cáo tiêu cực
    • Báo cáo lỗi

Tiếng Việt

Tiếng Việt
English

Đăng nhập

Đăng ký

d0662792

  • Giới thiệu
  • Bài tập
  • Bài nộp

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;
}


«    »
Thứ 2
Thứ 3
Thứ 4
Thứ 5
Thứ 6
Thứ 7
CN
Ít
Nhiều

proudly powered by DMOJ| developed by LQDJudge team