From 862f76ac0a008ca9e85cbbc66d7102dfbfd4303a Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Sun, 12 Oct 2025 21:45:35 +0900 Subject: [PATCH] =?UTF-8?q?[20251012]=20BOJ=20/=20G5=20/=20=EB=8B=A4?= =?UTF-8?q?=EC=9D=B4=EC=96=B4=ED=8A=B8=20/=20=EC=9D=B4=EA=B0=95=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...44\354\235\264\354\226\264\355\212\270.md" | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 "lkhyun/202510/12 BOJ G5 \353\213\244\354\235\264\354\226\264\355\212\270.md" diff --git "a/lkhyun/202510/12 BOJ G5 \353\213\244\354\235\264\354\226\264\355\212\270.md" "b/lkhyun/202510/12 BOJ G5 \353\213\244\354\235\264\354\226\264\355\212\270.md" new file mode 100644 index 00000000..00c9c15d --- /dev/null +++ "b/lkhyun/202510/12 BOJ G5 \353\213\244\354\235\264\354\226\264\355\212\270.md" @@ -0,0 +1,41 @@ +```java +import java.util.*; +import java.io.*; + +public class Main{ + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringBuilder sb = new StringBuilder(); + static int G; + + public static void main(String[] args) throws Exception { + G = Integer.parseInt(br.readLine()); + List results = new ArrayList<>(); + for (int b = 1; b * b <= G; b++) { + if (G % b == 0) { + int a = G / b; + + if ((a + b) % 2 == 0) { + int c = (a + b) / 2; + int p = (a - b) / 2; + + if (p >= 1) { + results.add(c); + } + } + } + } + + if (results.isEmpty()) { + bw.write("-1"); + } else { + Collections.sort(results); + for (int weight : results) { + bw.write(weight + "\n"); + } + } + + bw.close(); + } +} +```