From 17920a4463d0e6a55b6d0ae6f9ba2111a4e3bf02 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Wed, 2 Sep 2026 20:31:56 +0900 Subject: [PATCH] =?UTF-8?q?1072=20:=20=EA=B2=8C=EC=9E=84=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week6/BOJ1072/BOJ1072_V1.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/week6/BOJ1072/BOJ1072_V1.cpp diff --git a/src/week6/BOJ1072/BOJ1072_V1.cpp b/src/week6/BOJ1072/BOJ1072_V1.cpp new file mode 100644 index 0000000..42237be --- /dev/null +++ b/src/week6/BOJ1072/BOJ1072_V1.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +long long int X,Y,Z, ret=-1; +bool check(long long int num){ + return ((100 * (Y + num)) / (X+num)) != Z; +} +int main() { + + ios_base::sync_with_stdio(false); + cin.tie(nullptr); + cout.tie(nullptr); + + cin >> X >> Y; + Z = (100 * Y) / X; + int high = X, low = 1, mid; + + while(low <= high) { + mid = (high + low) / 2; + if (check(mid)) { + ret = mid; + high = mid - 1; + } else { + low = mid + 1; + } + } + + cout << ret << '\n'; + + + return 0; +} \ No newline at end of file