def cut_sticks(sticks):
count = 0
if sticks:
min_stick = min(sticks)
else:
return
new_sticks = []
for ele in sticks:
count += 1
new_ele = ele - min_stick
if new_ele != 0:
new_sticks.append(new_ele)
print(count)
cut_sticks(new_sticks)
input()
arr = [int(x) for x in input().strip().split(' ')]
cut_sticks(arr)
from collections import Counter
n = int(input())
arr = [int(x) for x in input().strip().split(' ')]
counter = Counter(arr)
for i in range(1000):
if counter[i]:
print(n)
n -= counter[i]
if n == 0: break
def cut_sticks(sticks):
count = 0
sticks.sort()
while sticks:
print(len(arr))
min_stick = sticks[0]
arr[:] = [ s - min_stick for s in sticks if s > min_stick]
input()
arr = [int(x) for x in input().strip().split(' ')]
cut_sticks(arr)
문제 요약: 막대기 중에 가장 작은 막대기로 나머지 막대기들을 잘라낸다. 한번 자를 때마다 남아있는 막대기를 출력한다.
댓글 없음:
댓글 쓰기