public class DeleteNum {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNextInt()) {
int len = sc.nextInt();
int[] index = new int[len];
System.out.println(countNum(len,index));
}
}
public static int countNum(int len, int[] index) {
int i = 0;
int count1 = 0;
int count2 = 0;
while (true) {
if(count2 == len) {
return i-1;
}
if (i == len) {
i = i % len;
}
if (count1 == 3) {
count1 =0;
count2++;
index[i % len] = -1;
}
i++;
}
}
}
删除数字
最新推荐文章于 2020-07-29 22:20:47 发布