#K71152. Wizard's Mana Quest
Wizard's Mana Quest
Wizard's Mana Quest
A powerful wizard is on a quest to achieve a target power level T. The wizard starts with an initial power P and encounters N mana pools along the journey. The mana pools each provide a specific amount of power, and the wizard collects all of them. The final power of the wizard is given by the formula: \(P + \sum_{i=1}^{N} a_i\).
The task is to determine whether the wizard can reach or exceed the target power T after collecting all the mana from the pools. If the final power is at least T, output Possible; otherwise, output Impossible.
inputFormat
The input is given via stdin and consists of two lines:
- The first line contains three space-separated integers \(N\), \(P\), and \(T\), representing the number of mana pools, the initial power, and the target power respectively.
- The second line contains \(N\) space-separated integers \(a_1, a_2, \dots, a_N\) representing the power available at each mana pool.
outputFormat
Print a single string to stdout: Possible
if the wizard's final power is at least \(T\), otherwise Impossible
.
3 1 10
2 3 4
Possible