标签:喝汽水
// 每瓶汽水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;
}
标签:喝汽水
原文地址:http://10915378.blog.51cto.com/10905378/1716912