Skip to content

Commit aefbf51

Browse files
committed
126차 2번 문제 풀이 (푸는중)
1 parent 699e985 commit aefbf51

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from collections import *
2+
3+
def solution(n, info):
4+
answer = []
5+
6+
q = deque()
7+
q.append((0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) # 현재 과녁, 상황
8+
max_gap = 0
9+
10+
while q:
11+
score, arrow = q.popleft()
12+
13+
if sum(arrow) == n:
14+
apeach, ryon = 0, 0
15+
for i in range(11):
16+
if info[i] != 0 or arrow[i] != 0:
17+
if info[i] >= arrow[i]:
18+
apeach += 10 - i
19+
else:
20+
ryon += 10 - i
21+
if apeach < ryon:
22+
gap = ryon - apeach
23+
if max_gap > gap:
24+
continue
25+
if max_gap < gap:
26+
max_gap = gap
27+
answer.clear
28+
answer.append(arrow)
29+
...
30+
return answer

0 commit comments

Comments
 (0)