Noise
Time limit1sMemory limit128 MB
Given two powers of ten with up to 100 digits and an operator, compute their sum or product using big-number arithmetic.
- Level
Easy3 of 10
- Topics
- Math, String, Implementation
- Solved
- No attempts yet
Problem
Two students keep talking during class. Sanggeun, a new teacher, decides to quiet the class by writing a large arithmetic problem on the board.
The students have learned only addition and multiplication, and both numbers written on the board are powers of 10. Each number has at most 100 digits.
Given two positive integers A and B and an operator, write a program that computes either A + B or A * B.
Input
The first line contains a positive integer A.
The second line contains an operator, either + or *.
The third line contains a positive integer B.
Both A and B are powers of 10, and each has at most 100 digits.
Output
If the given operator is +, output A + B. If it is *, output A * B.