255,550
社区成员




int count = 0; // 记录购买方案数量
for (int x = 0; x <= 100; x++) {
for (int y = 0; y <= 100 - x; y++) {
int z = 100 - x - y;
if (z % 3 == 0 && 3x + 5y + z/3 == 100) {
count++;
}
}}System.out.println("100元买100只鸡有" + count + "种买法。");
int num = 1020; // 西瓜数量
int count = 0; // 卖出天数
while (num > 0) {
num = num / 2 + 2; // 卖出一半多两个
count++; // 天数加1}
System.out.println("需要 " + count + " 天卖完所有西瓜");