int[] studentIds = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };//学生
            int[] schoolIds = new int[] { 1, 2 };//学校

            for (int i = 0; i < studentIds.Length; i++)
            {
                Console.WriteLine("studentId:" + studentIds[i]);
                if (i <= schoolIds.Length - 1)
                {
                    Console.WriteLine("schoolId:" + schoolIds[i]);
                }
                else
                {
                    Console.WriteLine("schoolId:" + schoolIds[i % schoolIds.Length]);
                }
            }

将多个学生平均分配到多个学校的方法示例

 

相关文章:

  • 2021-07-28
  • 2021-08-23
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
猜你喜欢
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
相关资源
相似解决方案