I. Question 5: Buy a rooster, 3: Buy a hen, and 3: Buy three chicks. How many brokers, hens, and chicks have to buy 100 chickens for one hundred yuan? II. The idea is to first list a mathematical formula. If the rooster, hen, and chicks have their own I, j, and k, then there is an equation: 5i + 3j + k/3 = 100 I + j + k = 100; I, j, k> = 0 obviously, there are multiple solutions to this problem. You can use the enumeration method. The maximum number of cocks is 20, because you need to buy 100. If you want to buy a rooster, the total number cannot meet the requirements. The minimum number is 0. Similarly, the maximum number of hens is 30, there are at least 0 chicks. The situation is special. Although you can buy about 300 chicks, you only need 100 chickens. And it costs 100 yuan, so it is impossible to only sell chicks. 3. Step 1. Create a triple for loop 2. Perform conditional judgment 3. Output 4. Code [java] package datastructure; /*** @ author wangpeng ***/public class Cock_number {/*** @ param args */public static void main (String [] args) {for (int I = 0; I <100/5; I ++) {for (int j = 0; j <100/3; j ++) {for (int k = 0; k <100*3; k ++) {if (I + j + k = 100 & I * 5 + j * 3 + j/3 = 100) {System. out. println ("Rooster:" + I + "\ t hen:" + j + "\ t chicken:" + k) ;}}} package datastructure; /*** @ author wangpeng ***/public class Cock_number {/*** @ param args */public static void main (String [] args) {for (int I = 0; I <100/5; I ++) {for (int j = 0; j <100/3; j ++) {for (int k = 0; k <100*3; k ++) {if (I + j + k = 100 & I * 5 + j * 3 + j/3 = 100) {System. out. println ("Rooster:" + I + "\ t hen:" + j + "\ t chicken:" + k) ;}}}}5. Output Rooster: 0 HEN: 25 chicken: 75 Rooster: 3 HEN: 20 chicken: 77 Rooster: 4 HEN: 18 Rooster: 78 Rooster: 7 HEN: 13 Rooster: 80 Rooster: 8 HEN: 11 chicken: 81 Rooster: 11 HEN: 6 chicken: 83 Rooster: 12 HEN: 4 chicken: 84