From 7af718d23c4cb3590f870d81124b496fb1e10aba Mon Sep 17 00:00:00 2001 From: mong3125 Date: Thu, 21 Mar 2024 02:04:05 +0900 Subject: [PATCH 01/10] =?UTF-8?q?BOJ1920=5F=EC=88=98=EC=B0=BE=EA=B8=B0=20j?= =?UTF-8?q?ava=20solution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\210\230\354\260\276\352\270\260.java" | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 "mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" diff --git "a/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" "b/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" new file mode 100644 index 0000000..1cd5ead --- /dev/null +++ "b/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" @@ -0,0 +1,46 @@ +package 이진탐색; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Arrays; +import java.util.StringTokenizer; + +public class BOJ1920_수찾기 { + + static int[] A; + static int[] targets; + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int N = Integer.parseInt(br.readLine()); + A = new int[N]; + + StringTokenizer st = new StringTokenizer(br.readLine()); + for (int i = 0; i < A.length; i++) { + A[i] = Integer.parseInt(st.nextToken()); + } + + int M = Integer.parseInt(br.readLine()); + targets = new int[M]; + st = new StringTokenizer(br.readLine()); + for (int i = 0; i < targets.length; i++) { + targets[i] = Integer.parseInt(st.nextToken()); + } + + Arrays.sort(A); + + for (int i = 0; i < targets.length; i++) { + int now = targets[i]; + System.out.println(binary(0, A.length - 1, now) ? 1 : 0); + } + } + + public static boolean binary(int from, int to, int n) { + if (from > to) return false; + int mid = (from + to) / 2; + + if (A[mid] == n) return true; + else if (A[mid] > n) return binary(from, mid - 1, n); + else return binary(mid + 1, to, n); + } +} From 08e3f4701542aa1abdec5f6e2d1f3f3834b6b102 Mon Sep 17 00:00:00 2001 From: mong3125 Date: Thu, 21 Mar 2024 02:04:18 +0900 Subject: [PATCH 02/10] =?UTF-8?q?BOJ1920=5F=EC=88=98=EC=B0=BE=EA=B8=B0=20j?= =?UTF-8?q?ava=20solution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BOJ1920_\354\210\230\354\260\276\352\270\260.java" | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git "a/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" "b/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" index 1cd5ead..c3e05b2 100644 --- "a/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" +++ "b/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" @@ -1,12 +1,10 @@ -package 이진탐색; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; -public class BOJ1920_수찾기 { +public class Main { static int[] A; static int[] targets; From 880e219b55c0021201a3d97456d73e650312e695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=8A=B9=ED=98=B8?= <132066506+YIM2UL2ET@users.noreply.github.com> Date: Thu, 28 Mar 2024 17:04:54 +0900 Subject: [PATCH 03/10] =?UTF-8?q?12=EC=B0=A8=EC=8B=9C=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YIM2UL2ET/README.md | 1 + ...2\354\260\250\354\213\234 - BOJ 11723.cpp" | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 "YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index 170c23b..32219bb 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -13,4 +13,5 @@ | 09차시 | 2024.03.07 | 임의 정밀도 / 큰 수 연산 && 재귀 | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) | | 10차시 | 2024.03.10 | 스택 | [BOJ 1406](https://www.acmicpc.net/problem/1406) | [BOJ 1406 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/31) | | 11차시 | 2024.03.18 | 스택 | [BOJ 1918](https://www.acmicpc.net/problem/1918) | [BOJ 1918 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/36) | +| 12차시 | 2024.03.28 | 비트마스킹 | [BOJ 11723](https://www.acmicpc.net/problem/11723) | [BOJ 11723 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/39) | --- diff --git "a/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" "b/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" new file mode 100644 index 0000000..c7b96fd --- /dev/null +++ "b/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" @@ -0,0 +1,36 @@ +#include + +int main(void) +{ + std::ios_base::sync_with_stdio(false); + std::cin.tie(NULL); + std::cout.tie(NULL); + + int n, k, bits = 0; + std::string command; + + std::cin >> n; + for (int i = 0; i < n; i++) { + std::cin >> command; + if (command == "add") { + std::cin >> k; + bits |= (1<> k; + bits &= ~(1<> k; + if (bits & (1<> k; + bits ^= (1< Date: Thu, 28 Mar 2024 20:26:59 +0900 Subject: [PATCH 04/10] =?UTF-8?q?2024-03-28=20=EC=B5=9C=EB=8C=80=ED=9E=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rivkms/README.md | 4 +++- rivkms/queue/11279.cpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 rivkms/queue/11279.cpp diff --git a/rivkms/README.md b/rivkms/README.md index 1b0ecbc..c2bc680 100644 --- a/rivkms/README.md +++ b/rivkms/README.md @@ -9,4 +9,6 @@ | 5차시 | 2024.02.24 | Backtracking | [입대](https://www.acmicpc.net/problem/31413) | [#5](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/18) | | 6차시 | 2024.02.27 | BFS | [토마토](https://www.acmicpc.net/problem/7576) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/20) | | 7차시 | 2024.03.01 | DP | [연속합](https://www.acmicpc.net/problem/1912) | [#7](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/25) | -| 8차시 | 2024.03.01 | Greedy | [회의실 배정](https://www.acmicpc.net/problem/1931) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/28) | \ No newline at end of file +| 8차시 | 2024.03.01 | Greedy | [회의실 배정](https://www.acmicpc.net/problem/1931) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/28) | +| 9차시 | 2024.03.22 | two-pointer | [두 수의 합](https://www.acmicpc.net/problem/3273) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/38) | +| 10차시 | 2024.03.28 | queue | [최대힙](https://www.acmicpc.net/problem/11279) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/38) | \ No newline at end of file diff --git a/rivkms/queue/11279.cpp b/rivkms/queue/11279.cpp new file mode 100644 index 0000000..3b1eae7 --- /dev/null +++ b/rivkms/queue/11279.cpp @@ -0,0 +1,34 @@ +#include +#include + +using namespace std; + + + +int main(){ + ios_base::sync_with_stdio(false); + cin.tie(NULL); + cout.tie(NULL); + + int n, tmp; + cin >> n; + + priority_queue q; + vector printq; + for(int i = 0; i < n; i++){ + cin >> tmp; + if(tmp == 0){ + if(q.empty()){ + cout << 0 << "\n"; + } + else{ + cout << q.top() << "\n"; + q.pop(); + } + } + else{ + q.push(tmp); + } + } + return 0; +} \ No newline at end of file From ed0996db2035441163080c3d10207680ba7ea6dd Mon Sep 17 00:00:00 2001 From: Minsung_Kang Date: Thu, 28 Mar 2024 20:28:09 +0900 Subject: [PATCH 05/10] Update README.md --- rivkms/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rivkms/README.md b/rivkms/README.md index c2bc680..1c1929f 100644 --- a/rivkms/README.md +++ b/rivkms/README.md @@ -11,4 +11,4 @@ | 7차시 | 2024.03.01 | DP | [연속합](https://www.acmicpc.net/problem/1912) | [#7](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/25) | | 8차시 | 2024.03.01 | Greedy | [회의실 배정](https://www.acmicpc.net/problem/1931) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/28) | | 9차시 | 2024.03.22 | two-pointer | [두 수의 합](https://www.acmicpc.net/problem/3273) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/38) | -| 10차시 | 2024.03.28 | queue | [최대힙](https://www.acmicpc.net/problem/11279) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/38) | \ No newline at end of file +| 10차시 | 2024.03.28 | queue | [최대힙](https://www.acmicpc.net/problem/11279) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/40) | \ No newline at end of file From 96a34b6a02b42edf042e3714d04dab2f39a5f989 Mon Sep 17 00:00:00 2001 From: mong3125 Date: Thu, 28 Mar 2024 23:36:49 +0900 Subject: [PATCH 06/10] =?UTF-8?q?BOJ1243=5F=EC=9D=B4=EC=A7=84=ED=83=90?= =?UTF-8?q?=EC=83=89=20java=20solution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\355\203\200\353\240\210\354\212\250.java" | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 "mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ2343_\352\270\260\355\203\200\353\240\210\354\212\250.java" diff --git "a/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ2343_\352\270\260\355\203\200\353\240\210\354\212\250.java" "b/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ2343_\352\270\260\355\203\200\353\240\210\354\212\250.java" new file mode 100644 index 0000000..6f357e2 --- /dev/null +++ "b/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ2343_\352\270\260\355\203\200\353\240\210\354\212\250.java" @@ -0,0 +1,66 @@ +package 이진탐색; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; +import java.util.StringTokenizer; + +public class BOJ2343_기타레슨 { + + static int N; + static int M; + static int[] lectures; + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + N = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + + lectures = new int[N]; + st = new StringTokenizer(br.readLine()); + + int sum = 0; + int max = 0; + for(int i = 0; i < N; i++) { + lectures[i] = Integer.parseInt(st.nextToken()); + sum += lectures[i]; + max = Math.max(max, lectures[i]); + } + + // 블루레이의 크기는 max부터 sum 사이 일것이다. + int result = minimumBlueray(max, sum); + + System.out.println(result); + } + + public static int minimumBlueray(int start, int end) { + if (start < end) return -1; + + int mid = (start + end) / 2; + + if (can(mid)) { + int more = minimumBlueray(start, mid - 1); + return more != -1 ? more : mid; + } + else return minimumBlueray(mid + 1, end); + } + + public static boolean can(int blueray) { + int count = M; + int i = 0; + int stack = blueray; + while (count > 0) { + while (stack - lectures[i] > 0) { + if (i == N) return true; + stack -= lectures[i]; + i++; + } + + stack = blueray; + count--; + } + + return false; + } +} From 7eaf940f660efe97376eb40d527ff53d0b47afea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=8A=B9=ED=98=B8?= <132066506+YIM2UL2ET@users.noreply.github.com> Date: Fri, 29 Mar 2024 22:13:13 +0900 Subject: [PATCH 07/10] =?UTF-8?q?13=EC=B0=A8=EC=8B=9C=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...13\354\260\250\354\213\234 - BOJ 7569.cpp" | 50 +++++++++++++++++++ YIM2UL2ET/README.md | 1 + 2 files changed, 51 insertions(+) create mode 100644 "YIM2UL2ET/BFS/13\354\260\250\354\213\234 - BOJ 7569.cpp" diff --git "a/YIM2UL2ET/BFS/13\354\260\250\354\213\234 - BOJ 7569.cpp" "b/YIM2UL2ET/BFS/13\354\260\250\354\213\234 - BOJ 7569.cpp" new file mode 100644 index 0000000..4db562f --- /dev/null +++ "b/YIM2UL2ET/BFS/13\354\260\250\354\213\234 - BOJ 7569.cpp" @@ -0,0 +1,50 @@ +#include +#include +#include + +struct idx {int z, y, x;}; + +int main(void) +{ + std::ios_base::sync_with_stdio(false); + std::cin.tie(NULL); + + int m, n, h, res = 0, non = 0; + std::vector offset = {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}}; + std::queue que[2]; + bool curQueue = false; + + std::cin >> n >> m >> h; + int box[h][m][n]; + + for (int z = 0; z < h; z++) { + for (int y = 0; y < m; y++) { + for (int x = 0; x < n; x++) { + std::cin >> box[z][y][x]; + if (box[z][y][x] == 1) que[curQueue].push({z, y, x}); + else if (box[z][y][x] == 0) non++; + } + } + } + + while (!que[curQueue].empty() && non > 0) { + while (!que[curQueue].empty()) { + int z = que[curQueue].front().z, y = que[curQueue].front().y, x = que[curQueue].front().x; + for (idx set : offset) { + int zz = z + set.z, yy = y + set.y, xx = x + set.x; + if (zz >= 0 && zz < h && yy >= 0 && yy < m && xx >= 0 && xx < n && box[zz][yy][xx] == 0) { + box[zz][yy][xx] = 1, non--; + que[!curQueue].push({zz, yy, xx}); + } + } + que[curQueue].pop(); + } + curQueue = !curQueue; + res++; + } + + if (non > 0) std::cout << -1; + else std::cout << res; + + return 0; +} \ No newline at end of file diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index 32219bb..2431e6c 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -14,4 +14,5 @@ | 10차시 | 2024.03.10 | 스택 | [BOJ 1406](https://www.acmicpc.net/problem/1406) | [BOJ 1406 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/31) | | 11차시 | 2024.03.18 | 스택 | [BOJ 1918](https://www.acmicpc.net/problem/1918) | [BOJ 1918 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/36) | | 12차시 | 2024.03.28 | 비트마스킹 | [BOJ 11723](https://www.acmicpc.net/problem/11723) | [BOJ 11723 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/39) | +| 13차시 | 2024.04.01 | BFS | [BOJ 7569](https://www.acmicpc.net/problem/7569) | [BOJ 7569 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/42) | --- From d536d12d89e2a9eb5f6395a738198a354e6d3a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=8A=B9=ED=98=B8?= <132066506+YIM2UL2ET@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:13:51 +0900 Subject: [PATCH 08/10] =?UTF-8?q?14=EC=B0=A8=EC=8B=9C=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YIM2UL2ET/README.md | 1 + ...4\354\260\250\354\213\234 - BOJ 11286.cpp" | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 "YIM2UL2ET/\354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/14\354\260\250\354\213\234 - BOJ 11286.cpp" diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index 2431e6c..97466af 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -15,4 +15,5 @@ | 11차시 | 2024.03.18 | 스택 | [BOJ 1918](https://www.acmicpc.net/problem/1918) | [BOJ 1918 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/36) | | 12차시 | 2024.03.28 | 비트마스킹 | [BOJ 11723](https://www.acmicpc.net/problem/11723) | [BOJ 11723 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/39) | | 13차시 | 2024.04.01 | BFS | [BOJ 7569](https://www.acmicpc.net/problem/7569) | [BOJ 7569 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/42) | +| 14차시 | 2024.04.04 | 우선순위 큐 | [BOJ 11286](https://www.acmicpc.net/problem/11286) | [BOJ 11286 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/43) | --- diff --git "a/YIM2UL2ET/\354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/14\354\260\250\354\213\234 - BOJ 11286.cpp" "b/YIM2UL2ET/\354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/14\354\260\250\354\213\234 - BOJ 11286.cpp" new file mode 100644 index 0000000..43b1864 --- /dev/null +++ "b/YIM2UL2ET/\354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/14\354\260\250\354\213\234 - BOJ 11286.cpp" @@ -0,0 +1,51 @@ +#include +#include + +void cre_heap(std::vector &heap, int key) { + int k = heap.size(); + heap.push_back(key); + while (k > 1) { + if (abs(heap[k/2]) > abs(heap[k]) || (abs(heap[k/2]) == abs(heap[k]) && heap[k/2] > heap[k])) { + std::swap(heap[k], heap[k/2]); + k /= 2; + } + else break; + } + return; +} + +void del_heap(std::vector &heap) { + int k = 1; + heap[1] = heap.back(), heap.pop_back(); + while (k * 2 <= heap.size()) { + if (k * 2 + 1 < heap.size() && (abs(heap[k*2+1]) < abs(heap[k*2]) || (abs(heap[k*2+1]) == abs(heap[k*2]) && heap[k*2+1] < heap[k*2]))) + k = k*2+1; + else k = k*2; + + if (abs(heap[k/2]) > abs(heap[k]) || (abs(heap[k/2]) == abs(heap[k]) && heap[k/2] > heap[k])) + std::swap(heap[k/2], heap[k]); + else break; + } + return; +} + +int main(void) { + std::ios_base::sync_with_stdio(false); + std::cin.tie(NULL); + std::cout.tie(NULL); + + int n, k, x; + std::vector abs_heap = {0}; + + std::cin >> n; + for (int i = 0; i < n; i++) { + std::cin >> x; + if (abs(x) > 0) cre_heap(abs_heap, x); + else if (abs_heap.size() > 1) { + std::cout << abs_heap[1] << '\n'; + del_heap(abs_heap); + } + else std::cout << 0 << '\n'; + } + +} \ No newline at end of file From 3db11137f51e477ab24ed01b17811c7532a4b493 Mon Sep 17 00:00:00 2001 From: mong3125 Date: Tue, 2 Apr 2024 02:35:04 +0900 Subject: [PATCH 09/10] =?UTF-8?q?BOJ1300=5FK=EB=B2=88=EC=A7=B8=EC=88=98=20?= =?UTF-8?q?java=20solution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\353\262\210\354\247\270\354\210\230.java" | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ1300_K\353\262\210\354\247\270\354\210\230.java" diff --git "a/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ1300_K\353\262\210\354\247\270\354\210\230.java" "b/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ1300_K\353\262\210\354\247\270\354\210\230.java" new file mode 100644 index 0000000..a255a9c --- /dev/null +++ "b/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ1300_K\353\262\210\354\247\270\354\210\230.java" @@ -0,0 +1,34 @@ +package 이진탐색; + +import java.util.Scanner; + +public class BOJ1300_K번째수 { + static int n; + static int k; + static int answer; + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + n = sc.nextInt(); + k = sc.nextInt(); + + index(0, k); + System.out.println(answer); + } + + public static void index(int front, int back) { + if (front > back) return; + + int mid = (front + back) / 2; + int sum = 0; + for (int i = 1; i <= n; i++) { + sum += Math.min(mid / i, n); + } + + if (sum < k) { + index(mid + 1, back); + } else { + answer = mid; + index(front, mid - 1); + } + } +} From c98fcb4c655394f029dac33c74c070be91434ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=A0=EC=9A=B0?= <51250442+InSange@users.noreply.github.com> Date: Sat, 11 May 2024 15:51:43 +0900 Subject: [PATCH 10/10] Update README.md --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eff2cb8..4250e6e 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,13 @@ **🧩해당 레포지토리 스터디 참가자** + +
+ +

+ +**🏆해당 레포지토리 스터디 수료자** + + + + + + +
@@ -58,8 +65,13 @@ mong3125 rivkms
24-02-12 ~
24-05-11
24-02-12 ~
24-05-11
24-02-12 ~
24-05-11
24-02-12 ~
24-05-11
-

## 🤝 규칙