import java.util.Scanner; public class ChickenAndMoney { public static void main(String[] args) { Scanner scan = new Scanner(System.in); Integer n = scan.nextInt(); if(n!=null) countChickenAndMoney(); } private static void countChickenAndMoney() { for (int x = 0; x < 100; x++) { for (int y = 0; y < 100; y++) { for (int z = 0; z < 100; z++) { if((z % 3 ==0) && (x+y+z == 100) && (5*x+3*y+z/3 == 100)) System.out.println(x + " " + y + " " +z); } } } } }
注意:z能够被3整除
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-28 21:28:00