. 喝不完的汽水
喝不完的汽水
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
“某商店规定:三个空汽水瓶可以换一瓶汽水。假如你手上有十个空汽水瓶,你最多可以换多少瓶汽水喝?”答案是5瓶,方法如下:先用9个空瓶子换3瓶汽水,喝掉3瓶满的,喝完以后4个空瓶子,用3个再换一瓶,喝掉这瓶满的,这时候剩2个空瓶子。然后你让老板先借给你一瓶汽水,喝掉这瓶满的,喝完以后用3个空瓶子换一瓶满的还给老板。如果小张手上有n个空汽水瓶,最多可以换多少瓶汽水喝?
Input
输入一个正整数n(1<=n<=1000),表示你手上的空汽水瓶数。
Output
输出一行,表示最多可以喝的汽水瓶数。如果一瓶也喝不到,输出0。
Samples
3
1
81
40
Limitation
1s, 1024KiB for each test case.
第七届SWPU-ACM新生预选赛
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 103
- Start at
- 2022-9-19 14:00
- End at
- 2022-10-28 14:00
- Duration
- 936 hour(s)
- Host
- Partic.
- 58