Bootstrap

喝汽水,1瓶汽水1元,2个空瓶可以换一瓶汽水,给20元,可以多少汽水。编程实现。

#include<stdio.h>
#include<Windows.h>
int  Heqishui(int n)
{
    static int rep=n;
    while (n > 1)
    {
        rep =rep + n / 2;
        n = n / 2 + n % 2;
    }
    return rep;
}
int main()
{
    int num = 20;
    printf("可以喝到%d瓶汽水\n", Heqishui(num));
    system("pause");
    return 0;
}
;