-
[백준] 16936 - 나3곱2 (파이썬)알고리즘/백준 2021. 9. 24. 18:02
n = int(input()) array = list(map(int,input().split())) cnt = 1 total = [] while len(total) != n: array2 = [] total2 = [] for i in range(len(array)): if array[i]%2 == 1: total2.append(array[i]*(2**(cnt-1))) array[i] = 0 else: array2.append(array[i]) array = array2[:] for i in range(len(array)): array[i] = array[i]//2 cnt += 1 total2.sort(reverse=True) for i in total2: total.append(i) print(*total)
'알고리즘 > 백준' 카테고리의 다른 글
[백준] 16948 - 데스 나이트 (파이썬) (0) 2021.09.24 [백준] 16947 - 서울 지하철 2호선 (파이썬) (0) 2021.09.24 [백준] 16929 - Two Dots (파이썬) (0) 2021.09.24 [백준] 16235 - 나무 재테크 (파이썬) (0) 2021.09.24 [백준] 16197 - 두 동전 (파이썬) (0) 2021.09.24