Given two integers, `num` and `t`. A number `x` is **achievable** if it can become equal to `num` after applying the following operation at most `t` times:
- Increase or decrease `x` by `1`, and **simultaneously** increase or decrease `num` by `1`.
Return the maximum possible value of `x`.
Given two integers, num and t. A number x is achievable if it can become equal to num after applying the following operation at most t times:
Increase or decrease x by 1, and simultaneously increase or decrease num by 1.
Return the maximum possible value of x.
Example 1:
Input: {"num":4,"t":1}
Output: 6
Constraints:
1≤num,t≤50
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"num":4,"t":1}
Each operation can move x one step and num one step at the same time. Moving them toward each other shrinks the distance by 2, so t = 1 operations close a distance of at most 2.