We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bbd2ae8 commit 83b258aCopy full SHA for 83b258a
1 file changed
live9/test95/문제3/박희경.py
@@ -0,0 +1,26 @@
1
+# 처음 푼 풀이
2
+from itertools import *
3
+
4
+def solution(brown, yellow):
5
+ answer = []
6
+ yellow_list = set()
7
+ if yellow == 1: yellow_list.add(1)
8
+ for i in range(1, yellow // 2 + 1):
9
+ if yellow % i == 0:
10
+ yellow_list.add(i)
11
+ yellow_list.add(yellow // i)
12
13
+ for x, y in product(yellow_list, repeat=2):
14
+ if x * y == yellow and x >= y:
15
+ if x * 2 + y * 2 + 4 == brown:
16
+ answer.append(x + 2)
17
+ answer.append(y + 2)
18
19
+ return answer
20
21
+# 다른 풀이 보니 중복 순열을 굳이 쓸 필요 없음
22
23
+ for i in range(1, int(yellow ** 0.5) + 1):
24
25
+ if (i + yellow // i) * 2 == brown - 4:
26
+ return [yellow // i + 2, i + 2]
0 commit comments