A/B to 2000 decimal places
InterviewTime limit0.5sMemory limit512 MB
Print A/B with exactly 2000 digits after the decimal point, truncating rather than rounding.
- Level
Easy3 of 10
- Topics
- Math, Implementation, Simulation
- Solved
- No attempts yet
Problem
You are given two integers and . Write a program that prints divided by with 2000 digits after the decimal point.
Input
The first line contains and , separated by a space. ()
Output
Print on the first line. Write the integer part, then a decimal point, then 2000 digits after the decimal point. Drop everything from the 2001st digit on instead of rounding it. When the division terminates, keep all 2000 places and pad the rest with zeros. Write 0 for an integer part of 0.
Hint
Double precision arithmetic cannot reach 2000 digits after the decimal point. Produce the digits one at a time with integer division, or use arbitrary precision integers.