package Winn_someone;
public class Mai_Ji {
public static void main(String[] args) {
int xj, count=0;
for (int gj = 1; gj <= 100; gj++) {
for (int mj = 1; mj <= 100; mj++) {
xj = 100 - gj - mj;
if (gj + mj + xj == 100 && gj * 5 + mj * 3 + xj / 3 == 100 && xj % 3 == 0) {
count = count + 1;
System.out.println("方案" + count);
System.out.println("公鸡:" + gj);
System.out.println("母鸡:" + mj);
System.out.println("小鸡:" + xj);
}
}
}
}
}
java编程练习【百钱买百鸡】
最新推荐文章于 2024-05-25 15:56:40 发布