A/B - 3
Time limit0.5sMemory limit512 MB
Given A and B with up to 10000 digits (possibly negative), compute the quotient and nonnegative remainder of A divided by B.
- Level
Hard8 of 10
- Topics
- Math, Implementation, String, Number theory
- Solved
- No attempts yet
Problem
Write a program that reads two integers A and B and prints the quotient and remainder of A/B.
For integers q and r, if A can be written as A = qB + r (0 ≤ r < |B|), then q is called the quotient and r the remainder.
Input
The first line contains A and B. (-10^10000 ≤ A, B ≤ 10^10000, B ≠ 0)
Output
Print the quotient of A/B on the first line and the remainder on the second line.