// 每瓶汽水1元,2个空瓶可以换1瓶汽水
// 现有20元,最多可以喝多少瓶?
#include<stdio.h>
int main()
{
int money = 0;
int total = 0;
int empty = 0;
scanf("%d",&money);
total = money;
empty = money;
while(empty>=2)
{
total = total + empty/2;
empty = empty%2 + empty/2;
}
printf("最多可以喝%d瓶\n",total);
return 0;
}
时间: 2024-10-05 05:48:33