publicclassTest{
publicstaticvoidmain(String[]args){
intcount=30;
intpossibleNum=1;
for(inti=4;i<=count;i+=4){
for(intj=4;j<=count-i;j+=4){
for(intx=2;x<=count-(j+i);x+=2){
if(x+j+i==count){
System.out.println("*************Possible"+possibleNum+++":");
System.out.println("pig="+(i/4));
System.out.println("dog="+(j/4));
System.out.println("chicken="+(x/2));
}
for(inty=2;y<=count-(x+j+i);y+=2){
if(y+x+j+i==count){
System.out.println("*************Possible"+possibleNum+++":");
System.out.println("pig="+(i/4));
System.out.println("dog="+(j/4));
System.out.println("chicken="+(x/2));
System.out.println("duck="+(y/2));
}
}
}
}
}
}
}