百马百担
package com.hanqi; public class baimabaidan { public static void main(String[] args) { // TODO 自动生成的方法存根 for (int i = 0; i <=100; i++) { for (int j = 0; j <=100; j++) { for (int k = 0; k <=100; k++) { if((i+j+k)==100) { if(3*i+2*j+k/2==100) { if(k%2==0) { System.out.println("大马"+i+"只\t中马"+j+"只"+"\t小马"+k+"只"); } } } } } } } }