Skip to content

Commit ea96d21

Browse files
author
hangyeol
committed
2번 문제풀이
1 parent e2cd7df commit ea96d21

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

live8/test87/문제2/백한결.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def solution(people, limit):
2+
answer = 0
3+
4+
people.sort()
5+
start = 0
6+
end = len(people) - 1
7+
8+
while start <= end:
9+
if people[start] + people[end] <= limit:
10+
start += 1
11+
end -= 1
12+
answer += 1
13+
14+
return answer
15+
16+
17+
people = [70, 50, 80, 50]
18+
limit = 100
19+
20+
print(solution(people, limit))

0 commit comments

Comments
 (0)