欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF2132C1.The Cunning Seller (easy version)
The Cunning Seller (easy version)
This is the easy version of the problem. The easy version differs from the hard one in that it requires determining the minimum cost with the least number of deals, while the hard version requires determining the minimum cost with a limited number of deals.
After the cunning seller sold three watermelons instead of one, he decided to increase his profit — namely, he bought even more watermelons. Now he can sell watermelons for coins, where is a non-negative integer. Such a sale is called a deal.
A calculating buyer came to him, but he has critically little time. Because of this, he wants to buy exactly watermelons, making the least possible number of deals.
The buyer is in a hurry and has therefore turned to you to determine the minimum number of coins he must pay the seller for watermelons, considering that he will make the least possible number of deals.
Input
The first line contains an integer — the number of test cases. The description of each test case follows.
In a single line of each test case, there is one integer — how many watermelons need to be bought.
Output
For each test case, output a single integer — the minimum cost of the watermelons.
Note
Note that there is no point in buying more watermelons than needed, so we won't consider deals where there are more watermelons than necessary.
Let's consider the costs of the first two deal options:
Deal A: watermelon — coins.
Deal B: watermelons — coins.
In the first sample, the only way to buy watermelon is to use Deal A, so the answer is .
In the second sample, you can buy watermelons with a single Deal B for coins.
In the third sample, you can make Deals A and Deals B, which will cost a total of coins. If we make deals, we can get , , , or watermelons. If we make fewer than deals, we will get no more than watermelons, which means it is impossible to buy watermelons for less than deals.
Samples
7
1
3
8
2
10
20
260010000
3
10
26
6
36
72
2250964728
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |