解题思路:
注意事项:
参考代码:
import java.util.*; import java.math.*; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); ArrayList list=new ArrayList(); for(int i=1;i<=n;i++){ list.add(i); } int count=1; int index=0; while(list.size()!=1){ if(index==list.size()){ index=0; } if(count%3==0){ list.remove(index); index--; } count++; index++; } System.out.println(list.get(0)); } }
0.0分
2 人评分
2005年春浙江省计算机等级考试二级C 编程题(3) (C语言代码)浏览:388 |
数组输出 (C语言代码)错误???浏览:558 |
简单的a+b (C语言代码)浏览:597 |
Minesweeper (C语言描述,蓝桥杯)浏览:1122 |
核桃的数量 (C语言代码)浏览:668 |
大家好,我是验题君浏览:576 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:653 |
C语言程序设计教程(第三版)课后习题11.8 (C语言代码)浏览:681 |
Pascal三角 (C语言代码)浏览:641 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:759 |