标签:
package mai100ji; public class Mai100ji { public static void main(String[] args) { int n = 100; for (int a = 0; a < 50; a++) { for (int b = 0; b <= 100; b++) { for (int c = 0; c <= 100; c++) { if (2 * a + b + 0.5 * c == 100 && a + b + c == n) { System.out.print("公鸡数量=" + a); System.out.print(" 母鸡数量=" + b); System.out.print(" 小鸡数量=" + c); System.out.println("\n"); } } } } } }
标签:
原文地址:http://www.cnblogs.com/sihuiming/p/5021670.html