1 package base.no4; 2 3 //百钱买百鸡 4 public class Maiji { 5 public static void main(String[] args) { 6 int a = 1, b = 1; 7 while (a <= 20) { 8 b=1; 9 while (b <= 50) { 10 if (5 * a + 2 * b + (100 - a - b) / 3 == 100 11 && (100 - a - b) % 3 == 0) { 12 System.out.println("公鸡"+a+"母鸡"+b+"小鸡"+(100-a-b)); 13 } 14 b++; 15 } 16 a++; 17 } 18 19 } 20 }