Back
Close

Should you fight?

Statement

 Goal

Your character needs to know if they should flee from a battle. Your damage output is a static D. You should fight if you can beat all your enemies or flee if you can't.

BEWARE!

-You die if your Heath Points / H reaches 0 or below.
-You hit first, and ALL the REMAINING enemies hit you back in one turn. So, you can only attack the 1st enemy and after your attack, your enemies attack you.
-You have to kill enemies in the given order so you don't have to worry about sorting them.
Input
Line 1: Integers H and D for the health points and damage separated by a space.
Line 2:Integer N for the number of enemies.
Next N lines: Two space separated integers EH and ED for the Enemy Health and Enemy Damage.
Output
Line 1 : flee or fight depending on the situation.
Constraints
1 ≤ D ≤ 20
0 < H,N,EH,ED
Example
Input
12 8
1
4 5
Output
fight

Game modes
Fastest, Shortest

Test cases
One Goblin Test
Input
12 8 1 4 5
Output
fight

Rats Validator
Input
100 20 2 2 2 2 2
Output
fight

Couple Goblins Test
Input
10 16 3 20 8 6 4 2 2
Output
flee

Sorcerer's Cave Validator
Input
50 18 5 10 2 80 10 6 6 3 2 12 12
Output
flee

Fat Bandit Test
Input
10 1 1 1000 1
Output
flee

Rogue Archer Validator
Input
10 1 1 2 10
Output
flee

Dungeon of the Code Test
Input
680 20 10 10 2 80 10 6 6 3 2 12 12 10 2 80 10 6 6 3 2 12 12
Output
fight

Roaches Validator
Input
100 10 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Output
fight

Obsessed Wizard Test
Input
45 15 1 16 21
Output
fight

Elementals Validator
Input
100 8 2 10 10 20 5
Output
fight

Exiled Prince Test
Input
20 17 1 23 42
Output
flee

Cavalry Validator
Input
100 8 5 10 10 10 10 10 10 10 10 10 10
Output
flee

Adult Dragon Test
Input
54389 20 1 63987 18
Output
flee

Observer Validator
Input
10 20 1 100 100
Output
flee

Solution language

Solution

Stub generator input