| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 14994 | The Hacker's Firewall |
|
| 14995 | The Dungeon Trial |
|
Description
You are trying to break into a high-security corporate mainframe using a dual-key security bypass. You must input two numerical access keys, a and b. The system grants access and registers a successful breach if at least one of the following structural loopholes is triggered:
- The sum of a and b is a multiple of 5.
- The value of a - b must be greater than 15.
- The product of a and b is even.
If at least one condition is true, print "Success!". Otherwise, print "Fail!"
Input
Two positive integers, a and b, provided on separate lines.
Output
If at least one condition is satisfied, print "Success!".
Otherwise, print "Fail!".
Sample Input Download
Sample Output Download
Tags
Discuss
Description
You enter a perilous dungeon equipped with initial HP, gold, and keys. To escape, you must clear three rooms in sequential order:
Room 1 -- The Guard:
- If your HP is greater than 50, you defeat the guard but take damage: lose 20 HP and gain 10 gold.
- Otherwise, you sneak past carefully: lose 10 Hp and gain 5 gold.
Room 2 -- The Treasure Room:
- If your new gold is at least 30, you unlock a hidden vault: spend 30 gold and gain 1 key.
- Otherwise, you only find scattered loose change: gain 10 gold and lose 5 HP.
Room 3 -- The Locked Door:
- If you have at least 1 key and your current HP is greater than 30, you unlock the exit: use 1 key and gain 50 gold.
- Otherwise, you are forced to break the door down by brute force: lose 10 HP.
Write a program to calculate and output your final stats (HP, gold, and keys) after clearing all three rooms.
Note that HP cannot go below 0. If your final HP is negative, set it to 0.
Input
The input consists of three integers representing your initial HP, gold, and keys, provided on separate lines.
Constraints:
- 1 <= HP <= 100
- 1 <= gold <= 100
- 0 <= keys <= 10
- Testcases 1, 2, 3: 1 <= HP <= 50, 1 <= gold < 30, 0 <= keys <= 10
- Testcases 4, 5: 1 <= HP <= 100, 1 <= gold <= 100, 0 <= keys <= 10
Output
Output your final HP, gold, and keys, each separated by a line.