解题思路:
注意事项:
每次剩余的瓶子是换的汽水数加上余下空瓶子
参考代码:
#include<stdio.h>
int main() {
int bottle;
int water = 0;
scanf("%d", &bottle);
while (bottle != 0) {
water = 0;
while (bottle >= 3) {
water += bottle / 3;
bottle = bottle / 3 + (bottle % 3);
}
if (bottle == 2)water++;
printf("%d\n", water);
scanf("%d", &bottle);
}
return 0;
}
0.0分
0 人评分