CHNSMKR - Chain Smoker
Sam is a chain smoker. But he has his own rules (!) of smoking. He doesn’t smoke less than 24 cigarette a day but not more than 30. The number of cigarette he buys he smokes all of them. And he doesn’t smoke the cigarettes whose price is less than a certain amount. Now his father doesn’t give him lots of money. So he is in financial problem, But a good news for him is if he buys 5 cigarette he will get 1 free. Now he wants to know what is the minimum cost of a cigarette he can smoke. He comes to you and requests to help him.
He gives you the minimum price of a cigarette he smoke ‘X’ and his budget ‘Y’. Now you have to find the minimum price of a cigarette he can smoke by following his own rules(!) and rest money. His concentration is smoke cigarette as many as possible between 24 to 30 in price not less then X. Can you help him?
Input
Input file contains several test cases. Each contains two positive integers X and Y separated by a space (0 < X ≤ 100, 0 < Y ≤ 1000). Input terminates by entering one of any input is zero that should not be processed.
Output
For each line of input print two integer A and B. Where ‘A’(A≥X) is the price of cigarette he can smoke and ‘B’ is the rest money. If it is not possible to fulfil the condition, print “Not Possible”.
Example
Input: 5 201 10 505 50 999 20 999 0 0 Output: 8 1 20 5 Not Possible 39 24
hide comments
krash_96:
2016-04-30 23:23:04
Easy problem . Made a silly mistake, AC in 2nd attempt. Sam shouldn't smoke that much lol. |
|
Rasedur Rahman Roxy:
2016-04-30 16:03:41
All previous problems are solved... :) |
|
[Rampage] Blue.Mary:
2016-04-30 05:38:26
Also, problem statement is very poorly stated. Better to provide more (useful) example and explanations. All examples provided now gives me identical information: he buys 25 cigarette. Don't know the number of cigarettes he actually smoked. |
|
[Rampage] Blue.Mary:
2016-04-30 05:16:00
Does he spend his budget to buy cigarette as many as possible? Last edit: 2016-04-30 05:18:21 |
|
utkarsh538:
2016-04-28 20:43:58
why no submit option?? |
|
lalit_nit2:
2016-04-28 18:07:59
really bad discription.... |
|
aqua_regia:
2016-04-28 17:48:53
@Roxy Where is the submit button? And in the first case x=5 y=201 he can also choose to smoke 26 cig at 9 money each. |
|
[Rampage] Blue.Mary:
2016-04-28 17:07:28
I've noticed lots of spelling & grammar mistakes in the problem statement.
|
Added by: | Roxy |
Date: | 2016-04-28 |
Time limit: | 1s |
Source limit: | 5000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | Own |