* Buy 100 chickens at 100 yuan,
* A rooster starts from 5 yuan,
* Hens come from 3 yuan,
* Chicken is 65438+3 in 0 yuan.
* Now 100 is just used up, and hens, cocks and chickens should be available.
* The total is 100.
* It is required to write a program in C language to realize how to calculate the number of all kinds of chickens. (The program is written on the back)
*/
Public course century chicken problem (
Private int chicken = 0,
hen = 0,
Chanticleer = 0,
Count = 0,
outsideTime = 0,
inside time = 0;
Public Century Chicken Problem () {
For (chicken =1; Chicken & lt= 100; chicken ++ ) {
for(hen = 1; Hen<= 100/3; hen ++ ) {
For (Chanticleer =1; Clear & lt= 100/5; Cock++) {
If( 100 == chicken+hen * 3+rooster * 5) {
count++;
System.out.println ("first" +count+ "possibility:");
System. out.println ("Chicken:"+Chicken +" only \ t "+ "Hen:"+Hen+"Only \ t"+"Rooster:"+Chanticleer+"Only \ t"+*: "+(Chicken+Hen+Chanticleer clear).
System. out.println ("Chicken:"+Chicken+"Yuan \t"+" Hen: "+Hen * 3+" Yuan \t"+ "Rooster:"+Rooster * 5+ "Yuan \ t "+" * *:+ (Chicken
if( count % 50 == 0 ) {
System.out.println ("Wait for 5 seconds and display the next 50 possibilities \ n");
for(outside time = 1; External time & lt= 10000; External time++) {
for(inside time = 1; insideTime & lt= 175000 ; insideTime ++ ) {
//Wait for 5 seconds and the next 50 possibilities will be displayed.
}
}
}
}
}
}
}
System. out.println ("* * meter:"+count+"possibility \ n");
}
Public static void main( String[] args) {
Chicken problem in the new century ();
}
}
It was all finished, only to find that the landlord formulated in C language. ..
I'm sorry/sorry/I feel bad/I can't wake myself up. ...