int m = 0; for (int x = 1; x * 3 <= 200; x++) { for (int y = 1; y * 2 <= 200; y++) { for (int z = 1; z * 15 <= 200; z++) { if (3 * x + 2 * y + 15 * z == 200) { Console.WriteLine(x + "个牙刷" + y + "个香皂" + z + "副羽毛球拍"); m++; } }
}
} Console.WriteLine("一共有多少种方法" + m);