DIEHARD - DIE HARD


Problem Statement:

The game is simple. You initially have ‘H’ amount of health and ‘A’ amount of armor. At any instant you can live in any of the three places - fire, water and air. After every unit time, you have to change your place of living. For example if you are currently living at fire, you can either step into water or air.

If you step into air, your health increases by 3 and your armor increases by 2

If you step into water, your health decreases by 5 and your armor decreases by 10

If you step into fire, your health decreases by 20 and your armor increases by 5

If your health or armor becomes <=0, you will die instantly

Find the maximum time you can survive.

Input:

The first line consists of an integer t, the number of test cases. For each test case there will be two positive integers representing the initial health H and initial armor A.


Output:

For each test case find the maximum time you can survive.

 

Note: You can choose any of the 3 places during your first move.

 

Input Constraints:

1 <= t <= 10
1 <= H, A <= 1000

Example:

Sample Input:

3
2 10
4 4
20 8

Sample Output:

1
1
5

hide comments
kanishkajoshi: 2016-07-22 20:15:52

My First Question of [spoiler removed] :)

Last edit: 2016-07-29 21:59:18
atulsinha007: 2016-07-20 07:14:20

My first [spoiler removed] problem. Very easy though.

Last edit: 2016-07-29 21:59:30
Ashish Gupta: 2016-07-12 15:44:34

Dammmmmmmmn!
After 30 hours of intensely beating my head on the table, FINALLY AC!

iamsg95: 2016-06-16 18:12:14

solved using [Spoiler removed] along with [Spoiler removed]... AC in one go:)

piyushhh: 2016-06-02 19:23:49

Do with the obvious [spoiler removed] approach. Not sure why a [spoiler removed] tag on the question.

Last edit: 2016-07-29 22:00:29
lynx_: 2016-05-29 21:35:01

lol....just random thought worked :) .. nice one

suman_biswas95: 2016-04-11 19:36:58

[removed spoiler test cases]

Last edit: 2016-07-29 22:49:28
surya2196: 2016-03-31 20:14:13

lolypop question

Deepak : 2016-03-30 05:00:11

nice one to do.AC on first go..

ujjax: 2016-03-27 10:43:27

Great problem!! ..... AC in first attempt with 0.0 :)


Added by:cegprakash
Date:2012-10-13
Time limit:10s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64