环形删除数字
2019-01-04 本文已影响0人
yuriy0_0

while True:
try:
n=int(input())
if n >1000:
n=1000
zeros=n*[0]
index=0
count=0
flag=n
while flag>1:
if zeros[index]==0:
count=count+1
if count==3:
zeros[index]=1
count=0
flag=flag-1
index=(index+1)%n
print(zeros.index(0))
except:
break