CLOSE THE GAP
All submissions for this problem are available.
Our lovely chef once won a free holiday to the amazing Maldives. But after reaching there he found out that the island which was next to him was better than his current, but unfortunately there was no bridge through which he can go to that island. Since he was very creative he found out a way to create a bridge between the two islands
There were infinite wooden plank of mass M and length L on the chef's island. Now you have to calculate at least how many planks he will require to create a bridge between two island if the distance between those two island is W.
The first line of the input contains an integer T denoting the number of test cases, for each test case input L i.e. length of planks and W distance between islands.
For each test case, output a single line with minimum number of planks required to make bridge.
- 1 ≤ T ≤ 100
- 1 ≤ L ≤ 60
- 1 ≤ W ≤ 50
Input: 2 4 5 10 9 Output: 7 1
Case 1 : for L = 4m and W = 5m , bridge can be constructed using minimum of 7 planks.
Case 2 : for L = 10m and W = 9m , bridge can be constructed using only single planks.
|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.