https://www.acwing.com/problem/content/1218/
大水题
233
简单数理分析即可知
由n瓶饮料,可以产生n个瓶盖 , 又可以用n个瓶盖换取n/3(下取整)瓶饮料,如此反复换取,直至瓶盖不足3个为止
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int n;
int res;
int main()
{
cin >> n;
res=n;
while(n>=3)
{
res+=n/3;
n=n/3+n%3;
}
cout << res << endl;
return 0;
}
标签:1216,int,换购,饮料,瓶盖,res,include From: https://www.cnblogs.com/lxl-233/p/16717494.html