590
社区成员
发帖
与我相关
我的任务
分享
公式: 3x + 2y + z/2 = 100 x + y + z = 100 z%2 = 0 化简得: 5x + 3y = 100 z % 2 = 0 Java code ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 public class CalculateHorses { public static void main(String[] args) { for(int x = 0; x <= 20; x++) { int t = 100 - 5 * x; if(t%3 == 0) { int y = t/3; int z = 100 - x - y; if(z%2 == 0) { System.out.println(x + ", " + y + ", " + z); } } } } }