From 2426c3faf9c51dd228d5de0bfe3be00fe9ca6527 Mon Sep 17 00:00:00 2001 From: oncsr Date: Fri, 14 Feb 2025 23:26:47 +0900 Subject: [PATCH] =?UTF-8?q?[20250214]=20BOJ=20/=20G4=20/=20=EB=AA=A8?= =?UTF-8?q?=EC=9E=90=EC=9D=B4=ED=81=AC=20/=20=EA=B6=8C=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\354\236\220\354\235\264\355\201\254.md" | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 "khj20006/202502/14 BOJ G4 \353\252\250\354\236\220\354\235\264\355\201\254.md" diff --git "a/khj20006/202502/14 BOJ G4 \353\252\250\354\236\220\354\235\264\355\201\254.md" "b/khj20006/202502/14 BOJ G4 \353\252\250\354\236\220\354\235\264\355\201\254.md" new file mode 100644 index 00000000..ed876bd1 --- /dev/null +++ "b/khj20006/202502/14 BOJ G4 \353\252\250\354\236\220\354\235\264\355\201\254.md" @@ -0,0 +1,81 @@ +```java + +import java.util.*; +import java.io.*; + +class Main { + + // IO field + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st; + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + static long nextLong() {return Long.parseLong(st.nextToken());} + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + static int N, M, C, K; + static List wrong; + static boolean[] exist; + static int max_x = 0; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + nextLine(); + N = nextInt(); + M = nextInt(); + + C = Integer.parseInt(br.readLine()); + K = Integer.parseInt(br.readLine()); + wrong = new ArrayList<>(); + exist = new boolean[M+1]; + + for(int i=0;i> 1; + while(s < e){ + + // m 센티미터의 색종이들 C개로 다 가릴 수 있는지? + int cnt = 0; + int p = 1; + while(p <= M){ + while(p <= M && !exist[p]) p++; + if(p > M) break; + cnt++; + p += m; + } + + if(cnt > C) s = m+1; + else e = m; + m = (s+e)>>1; + + } + + bw.write(m+"\n"); + + } + +} + +```