编写题解 1160: 出圈(队列) 摘要:解题思路:把m-1个数加到后面之后,删除第一个数即可注意事项:参考代码:while True: try: n,m = map(int,input().split()) …… 题解列表 2023年12月09日 1 点赞 0 评论 544 浏览 评分:0.0
出圈:重点是怎么在反复遍历一个圈时确定下标问题 解题思路:本题可以将所有的人从1到m设置好序号,然后放到列表里面,序号存在表示该人尚未出圈,每次遍历时index更新为(index+(m-1))%len(c),保证下标在超过范围时能够正确判断,每一次都进行判断删除直到列表长度为1时停止,此时列表中的唯一的序号c[0]就是所求的最后一个人的初始编号注意 题解列表 2023年11月08日 0 点赞 0 评论 613 浏览 评分:9.9
连续输入用重复执行解决 摘要:解题思路:模板给的开头和结尾还是很有用的遇到连续输入还好是还是要尽量用一下while true:try:except:break挺好用注意事项:参考代码:while True: try: …… 题解列表 2023年03月09日 0 点赞 0 评论 448 浏览 评分:0.0
编写题解 1160: 出圈 摘要:while True: try: n,m =map(int,input().split()) lis = list(range(1,n+1)) …… 题解列表 2021年12月22日 0 点赞 0 评论 570 浏览 评分:0.0
[出圈]幸存者问题 摘要:解题思路:注意事项:参考代码:while True: try: a, b = map(int, input().strip().split()) l = [i for…… 题解列表 2021年06月17日 0 点赞 0 评论 685 浏览 评分:0.0
[出圈]-题解(Python代码) ```pythonwhileTrue:m,n=map(int,input().split())lis=[iforiinrange(1,m+1)]k=1i=0whilelen(lis) 题解列表 2020年04月15日 0 点赞 1 评论 1032 浏览 评分:6.0
[出圈]-题解(Python代码) ```pythondeflastRemaining(n,m):x=0foriinrange(2,n+1):x=(m+x)%ireturnx+1whileTrue:a,b=map(int,input().split())print(lastRemaining(a,b))``` 题解列表 2020年04月11日 0 点赞 0 评论 1124 浏览 评分:9.9
[出圈]-题解(Python代码) whileTrue:n_number,m_number=map(int,input().split())#输入人数和mpeople_number=n_number#初始化人数等于输入的人数circle=list(range(1,n_number+1))#创建一个编号是1-n的圈子index=0#初始的 题解列表 2020年03月07日 0 点赞 0 评论 1839 浏览 评分:9.9
【出圈】-题解(Python代码)公式法! **代码如下:**whileTrue:a,b=map(int,input().split())x=0foriinrange(1,a+1):x=(x+b)%iprint(x+1) 题解列表 2019年12月25日 0 点赞 3 评论 1493 浏览 评分:7.3