11305: [yosupo] Big Integer - Division of Big Integers
[Creator : ]
Description
This problem has $T$ cases.
Given a non-negative integer $A$ and a positive integer $B$, print integers $q, r$ satisfying the following equation:
- $q = \left \lfloor \frac{A}{B} \right \rfloor$
- $A = qB + r$
Given a non-negative integer $A$ and a positive integer $B$, print integers $q, r$ satisfying the following equation:
- $q = \left \lfloor \frac{A}{B} \right \rfloor$
- $A = qB + r$
Input
$T$
$A$ $B$
$\vdots$
$A$ $B$
$A$ $B$
$\vdots$
$A$ $B$
Output
$q$ $r$
$\vdots$
$q$ $r$
$\vdots$
$q$ $r$
Constraints
- $1 \leq T \leq 2\times 10^6$
- $0 \leq A \leq 10^{@{2\times 10^6}}$
- $1 \leq B \leq 10^{@{2\times 10^6}}$
- The sum of (the number of characters in $A$) $+$ (the number of characters in $B$) over all test cases does not exceed $4,000,002$.
- $0 \leq A \leq 10^{@{2\times 10^6}}$
- $1 \leq B \leq 10^{@{2\times 10^6}}$
- The sum of (the number of characters in $A$) $+$ (the number of characters in $B$) over all test cases does not exceed $4,000,002$.
Sample 1 Input
6
47 10
50 10
3 10
0 10
100000000000000000000 9999999999
10000000000000000000000000000000000000000 99999999999999999999
Sample 1 Output
4 7
5 0
0 3
0 0
10000000001 1
100000000000000000001 1