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
|
||||||||||||||
2014-04-17 09:57:35 Ashish Tilokani
really easy! |
||||||||||||||
2014-04-17 09:57:35 Bumbler
Took me an year to do this problem ! And what a day 1/1/2014 ! :) |
||||||||||||||
2014-04-17 09:57:35 pranjuldb
easy problem... got ac in frst attempt:) |
||||||||||||||
2014-04-17 09:57:35 Hitman
Some Random Test Cases 1 5 5 80 100 200 500 600 1000 1000 1 5 57 217 399 |
||||||||||||||
2014-04-17 09:57:35 Rishabh Sharma
Easy one! No [spoiler removed].Simple logic :) Last edit: 2015-03-28 16:36:36 |
||||||||||||||
2014-04-17 09:57:35 Udit Kumawat
easy one.... :) AC in first attempt :) |
||||||||||||||
2014-04-17 09:57:35 Anant Kumar
@Rishabh: No need for [spoiler removed]. Simple logic would do. Last edit: 2015-03-28 16:37:07 |
||||||||||||||
2014-04-17 09:57:35 Rishabh
hint:recursion alone will not be able to help,luk to [spoiler removed] Last edit: 2015-03-28 16:37:28 |
||||||||||||||
2014-04-17 09:57:35 UTKARSH
what is output of h=1000 a=1000 pls check my code too [spoiler removed] Last edit: 2015-08-10 21:02:23 |
||||||||||||||
2014-04-17 09:57:35 BLANKRK
wow!!! got AC in fst attmpt btw eazy one...jus b simple :D |