The Professor's Calculator Is Broken!
InterviewTime limit1sMemory limit512 MB
Multiply N pairs of decimals given to 9 places and print each product with exactly 18 digits after the decimal point, no exponent notation.
- Level
Medium4 of 10
- Topics
- Math, Implementation, String, Brute force
- Solved
- No attempts yet
Problem
Puangi, a freshman at Chung-Ang University, built a calculator that handles decimals as an assignment for his Introduction to Computer Programming professor. One hour before the deadline, Puangi noticed that the calculator only computes accurately to the 6th decimal place. The professor, however, offers bonus points for computing to the 18th decimal place, and Puangi wants those bonus points to earn an A+.
Help Puangi earn an A+!
N lines each contain 2 decimals.
Print the product of the two decimals exactly to the 18th decimal place.
Input
The first line contains N (1 ≤ N ≤ 1000).
Each of the next N lines contains two decimals A and B (-4 ≤ A, B ≤ 4).
The decimals A and B are always given to the 9th decimal place. ex) 1.000000000, -0.000000001
Output
Print the product of the two decimals exactly to the 18th decimal place.
The answer must always be printed to the 18th decimal place. ex) 1.000000000000000000
Hint
Note that you must not use exponential notation such as 0E-18 when printing.