返回题解分享
讨论 / 题解分享/ 帖子详情

饮料换购(编程题) - 题解

#include <bits/stdc++.h>
typedef long long LL;
using namespace std;


int main()
{
	int n,res=0;
	cin>>n;
	res=n;
	while(n>=3)
	{
		n-=2;//换掉3个瓶盖,得到一个瓶盖,相当于花了两个瓶盖
      //能得到的饮料数(答案)加一
		res++;
	}
	cout<<res<<endl;
	return 0;
}
0 回复 0 转发 1 喜欢 1 阅读
回复 (0)
默认 最新
暂无回复,快来抢沙发!