From e313741cb0b08eeba0dd8688c0cfd4074b68babd Mon Sep 17 00:00:00 2001 From: sh0723 Date: Mon, 7 Sep 2026 15:47:35 +0900 Subject: [PATCH 1/2] =?UTF-8?q?1561=20:=20=EB=86=80=EC=9D=B4=20=EA=B3=B5?= =?UTF-8?q?=EC=9B=90=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week6/BOJ1561/BOJ1561_V1.cpp | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/week6/BOJ1561/BOJ1561_V1.cpp diff --git a/src/week6/BOJ1561/BOJ1561_V1.cpp b/src/week6/BOJ1561/BOJ1561_V1.cpp new file mode 100644 index 0000000..202b14f --- /dev/null +++ b/src/week6/BOJ1561/BOJ1561_V1.cpp @@ -0,0 +1,66 @@ +#include +using namespace std; +long long int N,M; +vector available; +bool check(long long int num) { + long long int cnt = M; + for (int i=0; i= N; +} +int main() { + + ios_base::sync_with_stdio(false); + cin.tie(nullptr); + cout.tie(nullptr); + + cin >> N >> M; + + + + for (int i=0; i> num; + available.push_back(num); + } + + if (N <= M) { + cout << N << '\n'; + return 0; + } + long long int mid,low=0,high=N*30, time; + + while(low <= high) { + mid = (low + high) / 2; + if (check(mid)) { + time = mid; + high = mid - 1; + } else { + low = mid + 1; + } + } + + long long finishTime = time; + long long before = M; + + for (int i = 0; i < M; i++) { + before += (finishTime - 1) / available[i]; + } + + long long int cnt = N-before; + + int ret = 0; + for (int i=0; i Date: Mon, 7 Sep 2026 15:56:03 +0900 Subject: [PATCH 2/2] =?UTF-8?q?1561=20:=20=EB=86=80=EC=9D=B4=20=EA=B3=B5?= =?UTF-8?q?=EC=9B=90=20=EA=B2=BD=EA=B3=A0=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week6/BOJ1561/BOJ1561_V1.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/week6/BOJ1561/BOJ1561_V1.cpp b/src/week6/BOJ1561/BOJ1561_V1.cpp index 202b14f..179a004 100644 --- a/src/week6/BOJ1561/BOJ1561_V1.cpp +++ b/src/week6/BOJ1561/BOJ1561_V1.cpp @@ -51,7 +51,6 @@ int main() { long long int cnt = N-before; - int ret = 0; for (int i=0; i