From 8c4ec3db41d62efd68513506e74a056d2d9cd827 Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Sat, 9 Aug 2025 03:12:22 +0900 Subject: [PATCH] =?UTF-8?q?[20250810]=20BOJ=20/=20G5=20/=20=EB=91=90=20?= =?UTF-8?q?=EB=B0=B0=20=EB=8D=94=ED=95=98=EA=B8=B0=20/=20=EA=B9=80?= =?UTF-8?q?=EC=88=98=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 \353\215\224\355\225\230\352\270\260.md" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "suyeun84/202508/10 BOJ G5 \353\221\220 \353\260\260 \353\215\224\355\225\230\352\270\260.md" diff --git "a/suyeun84/202508/10 BOJ G5 \353\221\220 \353\260\260 \353\215\224\355\225\230\352\270\260.md" "b/suyeun84/202508/10 BOJ G5 \353\221\220 \353\260\260 \353\215\224\355\225\230\352\270\260.md" new file mode 100644 index 00000000..6a74a868 --- /dev/null +++ "b/suyeun84/202508/10 BOJ G5 \353\221\220 \353\260\260 \353\215\224\355\225\230\352\270\260.md" @@ -0,0 +1,33 @@ +```java +import java.io.*; +import java.util.*; + +public class boj12931 { + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static StringTokenizer st; + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + + public static void main(String[] args) throws Exception { + nextLine(); + int N = nextInt(); + nextLine(); + int add = 0, multi = 0; + for (int i = 0; i < N; i++) { + int b = nextInt(); + int cnt = 0; + while (b > 0) { + if (b % 2 == 1) { + b--; + add++; + } else { + b /= 2; + cnt++; + } + } + multi = Math.max(multi, cnt); + } + System.out.println(add + multi); + } +} +```