public static void main(String[] args) { int a, b, c; for (a = 0; a <= 20; a++) for (b = 0; b <= 33; b++) for (c = 0; c <= 300; c = c + 3) { if (5 * a + 3 * b + c / 3 == 100 && a + b + c == 100) System.out.println("鸡翁" + a + "个,鸡母" + b + "个,鸡雏" + c+ "个"); } }