From 8b224b03fb061cc7cdf17a90c77f52122eb0e9be Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:31:38 +0900 Subject: [PATCH] =?UTF-8?q?[20250911]=20PGM=20/=20LV2=20/=20=EC=8B=9C?= =?UTF-8?q?=EC=86=8C=20=EC=A7=9D=EA=BF=8D=20/=20=EA=B9=80=EC=88=98?= =?UTF-8?q?=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\354\206\214 \354\247\235\352\277\215.md" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "suyeun84/202509/11 PGM LV2 \354\213\234\354\206\214 \354\247\235\352\277\215.md" diff --git "a/suyeun84/202509/11 PGM LV2 \354\213\234\354\206\214 \354\247\235\352\277\215.md" "b/suyeun84/202509/11 PGM LV2 \354\213\234\354\206\214 \354\247\235\352\277\215.md" new file mode 100644 index 00000000..4990246f --- /dev/null +++ "b/suyeun84/202509/11 PGM LV2 \354\213\234\354\206\214 \354\247\235\352\277\215.md" @@ -0,0 +1,23 @@ +```java +import java.util.*; +class Solution { + public long solution(int[] weights) { + long answer = 0; + Arrays.sort(weights); + Map map = new HashMap<>(); + for(int i : weights) { + double a = i*1.0; + double b = (i*2.0)/3.0; + double c = (i*1.0)/2.0; + double d = (i*3.0)/4.0; + if(map.containsKey(a)) answer += map.get(a); + if(map.containsKey(b)) answer += map.get(b); + if(map.containsKey(c)) answer += map.get(c); + if(map.containsKey(d)) answer += map.get(d); + map.put((i*1.0), map.getOrDefault((i*1.0), 0)+1); + } + + return answer; + } +} +```