运行代码:
#include<stdio.h>
int main()
{
int money = 0;//有多少钱
scanf("%d", &money);
int total = money;//初始有多少钱就能喝多少瓶
int empty = money;//一开始喝完后所拥有的空瓶
while (empty > 1)
{
total = total + empty / 2;
empty = empty / 2 + empty % 2;
}
printf("总共喝了%d瓶可乐\n", total);
return 0;
}