package Maintest;
import java.util.Scanner;
public class ReadNum {
public void fun() {// int num=new Input().stringToIntegerinput3();//不会导入包???
System.out.println("请输入围炉数数的总人数: ");
boolean[] a = new boolean[new Scanner(System.in).nextInt()];// a:围炉的人数
System.out.println("请输入数到该数字退出数数的数字: ");
int readnum = new Scanner(System.in).nextInt(); // readnum:数到该数字退出数数的数字
for (int i = 0; i < a.length; i++) {
a[i] = true;
}
int count = 0, i = 0, index = 0;
while (index <= a.length - readnum) {
if (a[i] == true) {
count++;
if (count == readnum) {
a[i] = false;
count = 0;
index++;
}
}
i++;
if (i == a.length) {
i = 0;
}
}
for (int j = 0; j < a.length; j++) {
if (a[j] == true) {
System.out.println("围炉数数的第" + (j + 1) + "位的人留下了。");
}
}
}
}