Submit | All submissions | Best solutions | Back to list |
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
Added by: | cegprakash |
Date: | 2012-10-13 |
Time limit: | 10s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
|
||||||||||||||
2016-03-26 19:16:57
Solved Using [Spoiler removed] :) Last edit: 2016-04-04 14:56:38 |
||||||||||||||
2016-03-26 15:45:24
please mention that "there can be more than one valid place to jump from a particular place" .. cost me 3 WA .. -_- |
||||||||||||||
2016-03-13 09:49:04 Rudra Nil Basu
Easy one, AC at first shot :D |
||||||||||||||
2016-03-08 18:24:25
Nice problem. |
||||||||||||||
2016-02-15 10:46:39
After 1 month cleared from Todo.... 1 month just coz of = sign :/ ......... |
||||||||||||||
2016-01-13 14:04:56
easy one ......only observation is needed........only observe |
||||||||||||||
2015-12-09 18:28:31 Aakash
The tag for this problem is a TRAP. |
||||||||||||||
2015-11-14 21:23:23 newbie
yeah accepted in one go with 0.00 :) |
||||||||||||||
2015-10-08 18:32:54 jarvis
First [spoiler] in one go :) Last edit: 2015-10-12 14:18:31 |
||||||||||||||
2015-08-29 22:29:20 Nallagatla Manikanta
Accepted in one go |