package com.hanqi.lianxi; public class baimabaidan { public static void main(String[] args) { int fangfa=0; for(int i=0;i<=33;i++) { for(int j=0;j<=50;j++) { for(int s=0;s<=100;s=s+2) { if(3*i+2*j+0.5*s==100&&i+j+s==100) { fangfa++; System.out.println("大马:"+i+"匹,中马:"+j+"匹,小马:"+s+"匹"); } } } } System.out.println("共有"+fangfa+"种方法"); } }