约瑟夫环,java数组解法

public class Test3 {
    public static void main(String[] args) {
        int n = 41;
        int m = 4;
        if(n<=1 || m<1) {
            System.out.println("you can't play game. n must be bigger than 1, m must be bigger than 0");
            return;
        }

        int[] arr = new int[n]; //长度为n的数组,位置从0——n-1,就代表了 n 个人的编号
        int count = 0; //纪录出圈人数
        int num = 0; //报数器
        for(int i=0;i 
 

你可能感兴趣的:(java,蓝桥杯,开发语言)