From 154db80fc6cbc7c2660f16ae68d9a54e98987973 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Tue, 1 Sep 2026 17:19:33 +0900 Subject: [PATCH] =?UTF-8?q?6236=20:=20=EC=9A=A9=EB=8F=88=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week6/BOJ6236/BOJ6236_V1.cpp | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/week6/BOJ6236/BOJ6236_V1.cpp diff --git a/src/week6/BOJ6236/BOJ6236_V1.cpp b/src/week6/BOJ6236/BOJ6236_V1.cpp new file mode 100644 index 0000000..39d45dd --- /dev/null +++ b/src/week6/BOJ6236/BOJ6236_V1.cpp @@ -0,0 +1,54 @@ +#include +using namespace std; +int N,M; +vector inp; +bool check_available(int money) { + int curr = money; + int cnt = 1; + for (int i=0; i M) return false; + } + return true; +} +int main() { + + ios_base::sync_with_stdio(false); + cin.tie(nullptr); + cout.tie(nullptr); + + cin >> N >> M; + int low=INT_MIN,high,mid; + + int sum = 0; + for (int i=0; i> money; + inp.push_back(money); + low = max(low,money); + sum += money; + } + high = sum; + + int ret = high; + while(low <= high) { + mid = (low + high) / 2; + + if (check_available(mid)) { + high = mid - 1; + ret = mid; + } else { + low = mid + 1; + } + } + + cout << ret << '\n'; + + + return 0; +} \ No newline at end of file