import java.util.Scanner; public class Main { public static void main(String[] args) { for (int male = 0; male <= 20; male++) { // 公鸡1个5元 100元最多能买20个 for (int female = 0; female <= 33; female++) { // 母鸡值3 33*3 int left = (100 - male * 5 - female * 3);//买公鸡 和 母鸡后的余额 if (male+female+left*3 ==100){ System.out.println(male + " " + female + " " + left*3);//鸡雏 值1/3 1元能买3个 } } } } }