RCB and Playoffs solution codechef

RCB and Playoffs solution codechef

Team RCB has earned XX points in the games it has played so far in this year’s IPL. To qualify for the playoffs they must earn at least a total of YY points. They currently have ZZ games left, in each game they earn 22 points for a win, 11 point for a draw, and no points for a loss.

2021 was approaching and the world was about to end. So 2 gods Saurabhx and Saurabhy (from Celesta) created the Cyberverse. But this time disappointed with humans both the gods decided not to have humans in this world. So they created a world of cyborgs. A world without humans. Isn’t it interesting? So let us dive into the cyberverse and have a look at their problems.

There are NN kid cyborgs with Chief Cyborg ‘100gods’ and he has KK weapons with him. He wants to distribute those KK weapons among NN kid cyborgs. Since all the kid cyborgs are very good friends, so they set a rule among themselves for taking those weapons. The rule states that the difference between kid cyborg having the maximum weapons and the kid cyborg having minimum weapons should be less than or equal to 11.
Find the value of the minimum number of weapons a kid cyborg can have when all the KK weapons are distributed among them.


  • The first line contains an integer TT, denoting the number of test cases.
  • Each of the next TT lines will contain two space-separated integers denoting NN and KK respectively.


  • For each test case ,output a single line containing an integer XX denoting the minimum number of weapons a kid cyborg can have in that test case.


  • 1T1051≤T≤105
  • 1N1051≤N≤105
  • 1K1091≤K≤109

Sample Input:

5 8

Expected Output:



  • There are 55 kids and 88 weapons.
  • Hence we will distribute the weapons such that 33 kids have 22 weapons each and the remaining 22 kids have 11 weapon each.
  • Hence the minimum number of weapons a kid cyborg has is 11. ( That is, min(1,2)min(1,2) = 11 )




RCB and Playoffs solution codechef

Leave a Comment