#CCBCHMUOI0000038. Nhiều lệnh độc lập theo mã (Independent Operations by Code)
Nhiều lệnh độc lập theo mã (Independent Operations by Code)
Independent Operations by Code
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given an operation code m and two integers a and b, code 1 requests a+b, code 2 requests a-b, and code 3 requests the larger of a and b (the common value if they are equal). Any other code prints INVALID. Perform exactly one operation.
Input
One line contains three integers m, a and b, in that order.
Output
Print the integer result, or exactly INVALID for an unknown operation code.
Subtasks
- Subtask 1 (20%): m = 1 and 0 <= a,b <= 10.
- Subtask 2 (30%): 1 <= m <= 3 and -100 <= a,b <= 100.
- Subtask 3 (50%): -10 <= m <= 10 and -10^6 <= a,b <= 10^6.
Examples
Example 1
Input
3 7 7
Output
7
Explanation
Code 3 requests the maximum. Both values are 7, so the answer is 7.
Example 2
Input
2 -4 9
Output
-13
Explanation
Code 2 subtracts b from a: -4-9=-13.
Example 3
Input
9 2 3
Output
INVALID
Explanation
Code 9 is not a supported operation.