PracticeSimulation
Next-Move Momentum
Context
In the arcade game Neon Vault, every move has a momentum marker. The marker can be positive, zero, or negative depending on the player's current streak. The scoring engine awards a rectangular momentum bonus based on the marker and the next consecutive marker value.
Problem
Implement a function that calculates the momentum bonus for a given integer marker. The bonus is the product of the marker and the integer immediately after it. Preserve the sign and exact arithmetic result for every allowed marker, including zero, negative markers, and large markers.
Examples
Example 1
Input:
marker = 5Output:
30Explanation: For marker 5, the executed function returns 30.
Example 2
Input:
marker = 0Output:
0Explanation: For marker 0, the executed function returns 0.
Example 3
Input:
marker = -4Output:
12Explanation: For marker -4, the executed function returns 12.
Constraints
-1000000000 <= marker <= 1000000000- Types:
markeris int; result is int
Function signature
def calculate_momentum_bonus(marker: int) -> int
markerint- The signed integer momentum marker for the current move.
- returns int
- The exact product of marker and the integer immediately greater than marker.
Adapted from MBPP problem task_35 (CC BY 4.0). Rewritten, extended and verified by Iksha.
Code
Saved