解题思路:
注意事项:
参考代码:
from itertools import cycle
def demo(lst,k = 3):
t_lst = lst[:]
while len(t_lst)>1:
c = cycle(t_lst)
for i in range(k):
t = next(c)
index = t_lst.index(t)
t_lst = t_lst[index+1:]+t_lst[:index]
return t_lst[0]
n = eval(input())
lst = list(range(1,n+1))
print(demo(lst,k=3))
0.0分
0 人评分