From 5169f3368799adc5a218db722ed5f42e23762b78 Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Tue, 17 Feb 2026 23:51:48 +0900 Subject: [PATCH] =?UTF-8?q?[20260217]=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=EC=9D=B8=ED=9D=AC?= 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" | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "LiiNi-coder/202602/17 BOJ \353\213\244\354\235\264\354\226\264\355\212\270.md" diff --git "a/LiiNi-coder/202602/17 BOJ \353\213\244\354\235\264\354\226\264\355\212\270.md" "b/LiiNi-coder/202602/17 BOJ \353\213\244\354\235\264\354\226\264\355\212\270.md" new file mode 100644 index 00000000..b51f179a --- /dev/null +++ "b/LiiNi-coder/202602/17 BOJ \353\213\244\354\235\264\354\226\264\355\212\270.md" @@ -0,0 +1,34 @@ +```java +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int G = Integer.parseInt(br.readLine()); + long old = 1; + long now = 2; + boolean isFind = false; + + while (now <= 100000 && old < now) { + long diff = now * now - old * old; + if (diff == G) { + System.out.println(now); + isFind = true; + old++; + } else if (diff < G) { + now++; + } else { + old++; + } + } + + + if (!isFind) { + System.out.println(-1); + } + } +} + +```