#CCBCHHAI0000037. Menu cộng trừ nhân (Add Subtract Multiply Menu)
Menu cộng trừ nhân (Add Subtract Multiply Menu)
Add Subtract Multiply Menu
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
The calculator processes commands sequentially. Code 1 prints ; code 2 prints ; code 3 prints . Each arithmetic command contains three integers code a b and produces one output line. Code 0 terminates, consists of a single zero with no operands, and produces no result. Process commands with a switch inside a do-while loop.
Input
A sequence of commands: codes 1/2/3 are followed by a b. The final command is the single integer 0, with no subsequent data. Operands are signed integers.
Output
For every arithmetic command, print one integer result on a separate line in command order. Code 0 prints nothing. If the first command is 0, the output is empty.
Subtasks
- Subtask 1 (20%): At most 5 commands including code 0; .
- Subtask 2 (30%): At most 100 commands including code 0; .
- Subtask 3 (50%): At most 10000 commands including code 0; .
Examples
Example 1
Input
1 7 4
2 7 4
3 -2 5
0
Output
11
3
-10
Explanation
Codes 1, 2 and 3 produce 11, 3 and -10. The final 0 reads no operands and prints nothing.
Example 2
Input
0
Output
Explanation
The input consists only of the stop code; output is empty.