diff --git "a/0224LJH/202511/16 PGM \354\227\260\354\206\215 \353\266\200\353\266\204 \354\210\230\354\227\264.md" "b/0224LJH/202511/16 PGM \354\227\260\354\206\215 \353\266\200\353\266\204 \354\210\230\354\227\264.md" new file mode 100644 index 00000000..67b7429a --- /dev/null +++ "b/0224LJH/202511/16 PGM \354\227\260\354\206\215 \353\266\200\353\266\204 \354\210\230\354\227\264.md" @@ -0,0 +1,42 @@ +```java +import java.io.*; +import java.util.*; + +class Solution { + + static HashSet set = new HashSet<>(); + + + public int solution(int[] elements) { + int len = elements.length; + + for (int i = 1; i <= len; i++){ + int curLen = i; + + int curSum = 0; + for (int j = 0; j < curLen; j++){ + curSum += elements[j]; + } + + int st = 0; + int end = curLen-1; + set.add(curSum); + + for (int j = 1; j < len; j++){ + curSum -= elements[st]; + st++; + end++; + end %= len; + curSum += elements[end]; + + set.add(curSum); + } + + } + + + int answer = set.size(); + return answer; + } +} +```