From d7b6f829e6aa3b6724075db2eb6a5b4e5c378d70 Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Sat, 6 Dec 2025 20:26:28 +0900 Subject: [PATCH] =?UTF-8?q?[20251206]=20PGM=20/=20Lv2=20/=20=EC=88=AB?= =?UTF-8?q?=EC=9E=90=EC=9D=98=20=ED=91=9C=ED=98=84=20/=20=EC=9D=B4?= =?UTF-8?q?=EC=A2=85=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\354\235\230 \355\221\234\355\230\204.md" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 "0224LJH/202512/06 PGM \354\210\253\354\236\220\354\235\230 \355\221\234\355\230\204.md" diff --git "a/0224LJH/202512/06 PGM \354\210\253\354\236\220\354\235\230 \355\221\234\355\230\204.md" "b/0224LJH/202512/06 PGM \354\210\253\354\236\220\354\235\230 \355\221\234\355\230\204.md" new file mode 100644 index 00000000..11db34b7 --- /dev/null +++ "b/0224LJH/202512/06 PGM \354\210\253\354\236\220\354\235\230 \355\221\234\355\230\204.md" @@ -0,0 +1,29 @@ +```java +import java.io.*; +import java.util.*; + +class Solution { + public int solution(int n) { + int start = 1; + int end = 1; + int curSum = 1; + + int answer = 0; + + while (end <= n){ + if (curSum == n){ + answer++; + end++; + curSum += end; + }else if (curSum < n){ + end++; + curSum += end; + }else{ + curSum -= start; + start++; + } + } + return answer; + } +} +```