python 求解约瑟夫问题
on_boat = [i+1 for i in range(30)]
off_boat = []
while len(off_boat)<=15:
for i in range(30):
if ((i+1)%9 ==0) and (on_boat[i] not in off_boat):
off_boat.append(on_boat[i])
print(off_boat)
————————————————
版权声明:本文为CSDN博主「yplnjtc」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yplnjtc/article/details/130001886