1485C.md (1165B)
1 Source: https://codeforces.com/problemset/problem/1485/C 2 3 C. Floor and Mod 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 A pair of positive integers $(a,b)$ is called special if $\lfloor \frac{a}{b} \rfloor = a \bmod b$. Here, $\lfloor \frac{a}{b} \rfloor$ is the result of the integer division between $a$ and $b$, while $a \bmod b$ is its remainder. 22 23 You are given two integers $x$ and $y$. Find the number of special pairs $(a,b)$ such that $1\leq a \leq x$ and $1 \leq b \leq y$. 24 25 Input 26 27 The first line contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases. 28 29 The only line of the description of each test case contains two integers $x$, $y$ ($1 \le x,y \le 10^9$). 30 31 Output 32 33 For each test case print the answer on a single line. 34 35 Example 36 37 Input 38 39 ``` 40 9 41 3 4 42 2 100 43 4 3 44 50 3 45 12 4 46 69 420 47 12345 6789 48 123456 789 49 12345678 9 50 ``` 51 52 Output 53 54 ``` 55 1 56 0 57 2 58 3 59 5 60 141 61 53384 62 160909 63 36 64 ``` 65 66 Note 67 68 In the first test case, the only special pair is $(3, 2)$. 69 70 In the second test case, there are no special pairs. 71 72 In the third test case, there are two special pairs: $(3, 2)$ and $(4, 3)$.