No.2882 Comeback
レベル :
/ AI推定難易度 : 1750
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 26
作問者 :
Iroha_3856
/ テスター :
Rac
tikuwa_
hiro1729
タグ : / 解いたユーザー数 26
作問者 :
Iroha_3856
/ テスター :
問題文最終更新日: 2024-09-08 08:24:25
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
Problem Statement
You are given positive integers $A, B$ satisfying $A < B$.
Find the number of positive integers $m$ satisfying $A \bmod m \geq B \bmod m$.
It can be proved that the answer is finite under these constraints.
You are given $T$ test cases; find the answer for each of them.
Input
$T$ $case_1$ $case_2$ $\vdots$ $case_T$
Each test case is given in the following format.
$A\ B$All inputs satisfy the following constraints.
- $T \leq 10$
- $1 \leq A < B \leq 10^{9}$
- All inputs are integers.
Output
Let $answer_i$ be the answer for $case_i$. Output in the following format, with a newline at the end.
$answer_1$ $answer_2$ $\vdots$ $answer_T$
Sample
Sample 1
Input
3 3 7 3141 5926 271828182 845904523
Output
6 4088 531127000
For the $1$st test case, the positive integers $m$ such that $A \bmod m \geq B \bmod m$ are the $6$ values $m = 1, 2, 4, 5, 6, 7$, so output $6$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。