From 4cd81094fd9a0779b59bc7ced956ec071b28b845 Mon Sep 17 00:00:00 2001 From: Ukj0ng <90972240+Ukj0ng@users.noreply.github.com> Date: Mon, 12 Jan 2026 20:27:42 +0900 Subject: [PATCH] =?UTF-8?q?[20260112]=20BOJ=20/=20G2=20/=20=EC=A0=80?= =?UTF-8?q?=EC=9A=B8=20/=20=ED=95=9C=EC=A2=85=EC=9A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../12 BOJ G2 \354\240\200\354\232\270.md" | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 "Ukj0ng/202601/12 BOJ G2 \354\240\200\354\232\270.md" diff --git "a/Ukj0ng/202601/12 BOJ G2 \354\240\200\354\232\270.md" "b/Ukj0ng/202601/12 BOJ G2 \354\240\200\354\232\270.md" new file mode 100644 index 00000000..417bf96d --- /dev/null +++ "b/Ukj0ng/202601/12 BOJ G2 \354\240\200\354\232\270.md" @@ -0,0 +1,43 @@ +``` +import java.io.*; +import java.util.*; + +public class Main { + private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + private static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + private static int[] weight; + private static int N, sum, answer; + + public static void main(String[] args) throws IOException { + init(); + + bw.write(answer+"\n"); + bw.flush(); + bw.close(); + br.close(); + } + + private static void init() throws IOException { + N = Integer.parseInt(br.readLine()); + weight = new int[N]; + + StringTokenizer st = new StringTokenizer(br.readLine()); + for (int i = 0; i < N; i++) { + weight[i] = Integer.parseInt(st.nextToken()); + } + + Arrays.sort(weight); + + sum = 0; + + for (int i = 0; i < N; i++) { + if (weight[i] > sum+1) { + break; + } + sum += weight[i]; + } + + answer = sum+1; + } +} +```