All submissions for this problem are available.
Today is the birthday of our friend Rahul. After cutting the cake he wants to treat his friends. However there are not many eateries where he lives .He doesn’t have much of a budget for the treat. He then finds a suitable restaurant.
At this restaurant only three food items are available: Cola, Burger and French fries. The price for the same is Rs.10, Rs.20 and Rs.30 respectively. Cola and Fries are large enough to be shared amongst 2 friends but the Burger cannot be shared. All the friends must have the beverage whether shared or individual while amongst the food items Burger and Fries, they should have one of them but the important condition is that total number of burgers served must be divisible by total number of fries served. Keep in mind that an item has to be bought entirely at the given price .
You need to compare the minimum cost required to make this arrangement with the budget assigned and tell Rahul whether he can treat his friends in his budget or not.
The first line contains an integer N denoting the number of friends
Second line contains an integer M denoting budget of Rahul.
print in a single line yes or no denoting whether Rahul can treat his friends or not in given budget.
- 4 ≤ N ≤ 450
- 0 ≤ M < 10000
Input: 6 150 Output: yes
For 6 friends, we first calculate the minimum cost requirement as per the problem. It is found that cost is minimum when 3 colas(each shared among 2 friends), 2 burgers and 2 fries (each shared among 2 friends) are served. Note that the condition that number of burgers is divisible by number of fries is satisfied and then minimum cost is obtained. Therefore the cost becomes 3*10+2*20+2*30 = 130 which is less than the budget provided. Hence, the output is yes.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.