We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9706c51 commit 1c81cf2Copy full SHA for 1c81cf2
1 file changed
live9/test95/문제3/백한결.py
@@ -0,0 +1,31 @@
1
+import itertools
2
+
3
4
+def solution(brown, yellow):
5
+ answer = []
6
+ pair = []
7
8
+ total = brown + yellow
9
10
+ divisors = getDivisor(total)
11
12
+ for comb in itertools.product(divisors, repeat=2):
13
+ if (comb[0] - 2) * (comb[1] - 2) == yellow and comb[0] >= comb[1]:
14
+ pair.append(comb)
15
16
+ pair.sort(reverse=True)
17
18
+ answer.append(pair[0][0])
19
+ answer.append(pair[0][1])
20
21
+ return answer
22
23
24
+def getDivisor(num):
25
+ divisors = []
26
27
+ for i in range(1, num + 1):
28
+ if num % i == 0:
29
+ divisors.append(i)
30
31
+ return divisors
0 commit comments