201712-2(Python实现)

2019-12-09  本文已影响0人  tmax
n, k = list( map(int, input().split()) )

count = 0
idx = 0
ids = [i for i in range(n)]
while len(ids)>1:
    count += 1
    if count%k==0 or int(str(count)[-1])==k:
        ids.pop(idx)
    else:
        idx += 1
    if idx >= len(ids):
        idx = 0
print(ids[0]+1)
上一篇下一篇

猜你喜欢

热点阅读