# Cigarette Puzzle

## The Prisoner and Cigarette Puzzle

Solve the Prisoner and Cigratte Puzzle. A was serving in the prison and had a bad smoking problem. He would always be smoking in his cell. One day he figured out that using 3 cigarette butts, if he combines them together it forms 1 full cigarette, So using this technique he was able to smoke more cigarettes. On a particular day, A had the urge to smoke 5 cigarettes however he did not have any pack with him and only had 10 butts. He really wanted to smoke but since he did not have enough, he wondered what he could do. He looked over at his cellmate B’s pile of cigarette butts and considered stealing; however, B always kept his butts counted and if he finds one missing he will beat A up.

Question:-

• Help A to figure out a plan such that he is able to smoke 5 cigarettes.

## The Prisoner and Cigarette Puzzle

Solve the Prisoner and Cigarette Puzzle. A was serving in the prison and had a bad smoking problem. He would always be smoking in his cell. One day he figured out that using 3 cigarette butts, if he combines them together it forms 1 full cigarette, So using this technique he was able to smoke more cigarettes. On a particular day, A had the urge to smoke 5 cigarettes however he did not have any pack with him and only had 10 butts. He really wanted to smoke but since he did not have enough, he wondered what he could do. He looked over at his cellmate B’s pile of cigarette butts and considered stealing; however, B always kept his butts counted and if he finds one missing he will beat A up.

Question:-

• Help A to figure out a plan such that he is able to smoke 5 cigarettes.

## Solution

To be able to smoke 5 cigarettes, A can perform the following steps:-

• First with his 10 butts A uses 9 and form 3 cigarettes.
• He smokes those 3 and gets 3 butts.
• He turns these 3 butts and smokes them as 1 cigarette. Then he is left with 2 butts, 1 from his current cigarette and the other from his first 10 butts.
• He then “borrows” one butt from B’s pile and makes the 5th cigarette and when he gets the butt he puts it back in B’s pile.

## Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others