From efe38dd1b4875f058f6dd6d50dba80b7165239af Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Apr 2025 09:54:11 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=98=A4=EB=8A=98=EC=9D=98=20=EC=95=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=EC=A6=98]=20=EC=8B=9C=EC=86=8C=20=EC=A7=9D?= =?UTF-8?q?=EA=BF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...234\354\206\214 \354\247\235\352\277\215.py" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "yongjun-0903/\354\213\234\354\206\214 \354\247\235\352\277\215.py" diff --git "a/yongjun-0903/\354\213\234\354\206\214 \354\247\235\352\277\215.py" "b/yongjun-0903/\354\213\234\354\206\214 \354\247\235\352\277\215.py" new file mode 100644 index 0000000..468965f --- /dev/null +++ "b/yongjun-0903/\354\213\234\354\206\214 \354\247\235\352\277\215.py" @@ -0,0 +1,17 @@ +from itertools import combinations +from math import gcd + +def solution(weights): + answer = 0 + combs = list(combinations(weights, 2)) + siso = [2, 3, 4] + + for comb in combs: + if comb[0] == comb[1]: + answer += 1 + else: + x = gcd(comb[0], comb[1]) + if comb[0] // x and comb[1] // x in siso: + answer += 1 + + return answer