略懂c语言
2022-05-23 23:23
采纳率: 92.3%
浏览 78

c语言简单运用,简单运用


n,m,k = (*map(int,input().split()),)
pos,monkey = k,[*range(1,n+1)]
 
while len(monkey)>1:
        pos = k if pos==m else m
        idx = (pos-1) % len(monkey)
        monkey = monkey[:idx][::-1] + monkey[idx+1:][::-1]
        
print(*monkey)

https://ask.csdn.net/questions/7706963?spm=1005.2026.3001.5622

1条回答 默认 最新

相关推荐 更多相似问题