解题思路:
注意事项:
参考代码:
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 人评分
数字游戏 (C++代码)浏览:1180 |
数组与指针的问题浏览:716 |
演讲大赛评分 (C语言代码)浏览:1629 |
2006年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:661 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:946 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:530 |
矩阵的对角线之和 (C语言代码)浏览:1345 |
矩阵转置 (C语言代码)浏览:782 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:535 |
拆分位数 (C语言代码)浏览:441 |