Algorithm/lanqiao/series13sheng/td_tle.py

14 lines
275 B
Python
Raw Normal View History

2022-04-09 12:19:47 +08:00
import io
import sys
# import time
sys.stdin = io.StringIO('1000000\n5')
# start = time.time()
n, m = int(input()), int(input())
nums = [i for i in range(1, n + 1)]
nums.sort(key=lambda x: sum(map(int, list(str(x)))))
print(nums[m - 1])
# print(time.time() - start) # 2s