Saving the love of my life
All submissions for this problem are available.
Deadpool wants to take Vanessa for a date. AJayX kidnaps Vanessa and imprisons her at the top floor of his dungeon.
Surprisingly the dungeon is in an apartment complex of n floors, numbered 1 to n, and being short on budget :) , AJayX can only lease some floors (continuous) for his dungeon from floor a to floor b (inclusive).
Also to make sure that deadpool cannot come and rescue Vanessa, AJayX places guards on some of the floors he has leased.
Being a bit eccentric, he only places guards on those floors from a to b (inclusive), where the floor number has highest number of divisors.
It's real easy for deadpool to defeat the guards but he still takes 1 unit of health damage per guarded floor and deadpool goes to hibernation for few hours if his health ever reaches 0 or less.
Your task is to help Deadpool find the minimum amount of health units he needs to reach Vanessa without hibernating.
Deadpool never dies, he just hibernates :).
First line contain number of test cases T , next T line contains two numbers a and b.
Output minimum amount of health units he needs to reach Vanessa.
- 1 ≤ T ≤ 10^2
- 2 ≤ n(number of floors) ≤ 10^8
- 0 ≤ b-a ≤ 10^4
Input: 2 2 9 1 10 Output: 3 4
Author : Ganesh Sawhney
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, 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, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.