mirror of
https://github.com/iritmaximus/tira.git
synced 2026-10-12 19:13:47 +03:00
22 lines
418 B
Python
22 lines
418 B
Python
from heapq import heappush, heappop
|
|
|
|
|
|
def smallest(n):
|
|
list = []
|
|
heappush(list, 1)
|
|
|
|
for x in range(n):
|
|
first_item = list[0]
|
|
heappush(list, first_item * 2)
|
|
heappush(list, first_item * 3)
|
|
heappop(list)
|
|
|
|
return list[0]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(smallest(1)) # 2
|
|
print(smallest(5)) # 6
|
|
print(smallest(123)) # 288
|
|
print(smallest(55555)) # 663552
|