| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 14891 | Simple GeoGuesser |
|
| 14889 | Leveling Up |
|
Description
Given a target point on a 2D plane, you are also given two additional points: your guess and your opponent's guess about that point. Your task is to determine who is closer to the target point based on the Euclidean distance.
Hint: you can slightly modify how you calculate Euclidean distance to better solve the problem.
Constraints
- -109 <= x, y <= 109
- All coordinates are integers.
Input
The input consists of one line that has 6 numbers in sequence:
- Target point: Xt Yt
- Your guess: Xa Ya
- Opponent's Guess: Xb Yb
Output
-
Output "WIN" with '\n' if your guess is closer to the target than your opponent's guess.
-
Output "DRAW" with '\n' if both guesses are at the exact same distance from the target.
-
Output "LOSE" with '\n' if your opponent's guess is closer to the target than yours.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
You are a player starting at Level 0 with 0 XP. You will perform N actions, and each action awards you a certain amount of experience points (XP).
The XP values for each type of actions are:
- Type 1: killing a zombie. You gain 10 XP.
- Type 2: killing a skeleton. You gain 15 XP.
- Type 3: using bottle of experience. You gain 100 XP.
Leveling Up Mechanism
To advance from your current level to the next, you must consume XP equal to the square of the target level.
-
To reach Level 1 from Level 0, it costs 12 = 1 XP.
-
To reach Level 2 from Level 1, it costs 22 = 4 XP.
-
To reach Level 3 from Level 2, it costs 32 = 9 XP.
-
In general, to reach Level L+1, you must spend (L+1)2 XP.
As long as your current XP is enough to pay for the next level's cost, you must level up immediately and subtract the cost from your total XP. This process continues until you can no longer afford the next level.
Constraints
- For testcases 1~4, 0 <= N <= 100.
- For testcase 5, 0 <= N <= 20000.
Input
-
The first line is an integer N, the number of actions.
-
Then following by N lines, each containing a single number (1, 2, or 3), representing the action type.
Output
An integer representing the player's final level with '\n'.