public class BuyChicken {
public static void buyChicken() {
for (int a = 0; a <= 100 / 5; a++) {
for (int b = 0; b <= 100 / 3; b++) {
for (int c = 0; c <= 100; c++) {
if (c % 3 != 0) continue;
int s1 = a + b + c;
int s2 = a * 5 + b * 3 + c / 3;
if (s1 == 100 && s2 == 100) {
System.out.printf("公鸡:%d只,母鸡:%d只,小鸡:%d只!%n", a, b, c);
}
}
}
}
}
public static void main(String[] args) {
buyChicken();
}
}