我的思路是 将每种颜色的珠子的位置几率下来 然后根据 距离来算 比如 5 2 3 3 1 2 3 0 2 2 3 1 2 1 3 第一种颜色true false false false false 第二种颜色true false true true false 第三种颜色true false true false true Scanner scanner =new Scanner(System.in); int count =0; int n= scanner.nextInt(); int m =scanner.nextInt(); int c=scanner.nextInt(); ...