因数很多AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)You are given integers $N$ and $D$, each at least $2$.
给定两个整数 $N$ 和 $D$,它们均至少为 $2$。AI (CI翻译)
Among the positive integers at most $N$ that are not multiples of $D$, find one with the maximum number of positive divisors. If there are multiple such positive integers, output any one of them.
请从不超过 $N$ 且不是 $D$ 的倍数的正整数中,找出正因数个数最多的一个。如果有多个满足条件的正整数,输出其中任意一个即可。AI (CI翻译)
You are given $T$ test cases; solve each of them.
给定 $T$ 组测试数据,请分别求解每组数据。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1 \leq T \leq 10$$2 \leq D \leq N \leq 10^{18}$- All input values are integers.
$1 \leq T \leq 10$$2 \leq D \leq N \leq 10^{18}$- 所有输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入按以下格式给出:AI (CI翻译)
T
\text{case}_1
\text{case}_2
\vdots
\text{case}_T
T
\text{case}_1
\text{case}_2
\vdots
\text{case}_TAI (CI翻译)
Here, $\text{case}_i$ represents the $i$-th test case, and is given in the following format:
其中,$\text{case}_i$ 表示第 $i$ 组测试数据,格式如下:AI (CI翻译)
N D
N DAI (CI翻译)
Output
输出格式
AI (CI翻译)Output $T$ lines. The $i$-th line should contain the answer for the $i$-th test case.
输出 $T$ 行。第 $i$ 行应包含第 $i$ 组测试数据的答案。AI (CI翻译)
样例
4
10 2
17 4
2026 919
1000000000000 48
9
15
1680
843291048600
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。