解题思路:所有人看成一个列表,报到3时出圈看成3之前的人移到列表最后去,继续报3再移到后面去直到只乘2人,第一个报1和3出圈 n = int(input()) if n ==1: print(1) else: ls = list(range(1,n+1): while len(ls)>2: #循环执行 lt = ls[:2] #去掉3后要移到最的列表前部分 lh = ls[3:] #去掉3后后半部分 ls = lh+lt #把两部分连起来 print(ls[1])
0.0分
2 人评分
C二级辅导-计负均正 (C语言代码)浏览:598 |
C语言考试练习题_排列 (C++代码)浏览:704 |
简单的a+b (C语言代码)浏览:778 |
C语言训练-最大数问题 (C语言代码)浏览:643 |
【绝对值排序】 (C++代码)浏览:712 |
拆分位数 (C语言代码)浏览:1347 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:603 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:505 |
Wu-求圆的面积 (C++代码)浏览:1984 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:641 |