int Calculate(int x)
{
int all = x;
int empty = x;
while (empty > 1)
{
all = all + empty / 2;
empty = empty / 2 + empty % 2;
}
return all;
}
int main()
{
int bottle = 0;
scanf("%d", &bottle);
int toltal = Calculate(bottle);
printf("%d", toltal);
return 0;
}
喝汽水,1瓶汽水1元,2个空瓶可以换一瓶汽水,如果给20元,可以喝多少汽水。
最新推荐文章于 2024-11-11 23:45:00 发布