11308: [yosupo] Big Integer - Division of Hex Big Integers
[Creator : ]
Description
This problem has $T$ cases.
Given a hexadecimal non-negative integer $A$ and a hexadecimal positive integer $B$, print hexadecimal integers $q, r$ satisfying the following equation:
- $q = \left \lfloor \frac{A}{B} \right \rfloor$
- $A = qB + r$
Given a hexadecimal non-negative integer $A$ and a hexadecimal positive integer $B$, print hexadecimal 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 16\times 10^5$
- $0 \leq A < 16^{16\times 10^5}$
- $1 \leq B < 16^{16\times 10^5}$
- The sum of (the number of characters in $A$) $+$ (the number of characters in $B$) over all test cases does not exceed $3200002$.
- $0 \leq A < 16^{16\times 10^5}$
- $1 \leq B < 16^{16\times 10^5}$
- The sum of (the number of characters in $A$) $+$ (the number of characters in $B$) over all test cases does not exceed $3200002$.
Sample 1 Input
8
47 1F
50 1F
3 1F
0 1F
100000000000000000000 FFFFFFFFFF
1000000000000000000000000000000000 FFFF
10000000000000000000000000000000000000000 FFFFFFFFFFFFFFFFFFFF
FFFFFFFFFF FFFFFFFFFE
Sample 1 Output
2 9
2 12
0 3
0 0
10000000001 1
100010001000100010001000100010 10
100000000000000000001 1
1 1