A16135 | Longest Divisors Interval
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Given a positive integer $n$ , find the maximum size of an interval $[l, r]$ of positive integers such that, for every $i$ in the interval (i.e., $l \leq i \leq r$ ), $n$ is a multiple of $i$ .
Given two integers $l\le r$ , the size of the interval $[l, r]$ is $r-l+1$ (i.e., it coincides with the number of integers belonging to the interval).
Given two integers $l\le r$ , the size of the interval $[l, r]$ is $r-l+1$ (i.e., it coincides with the number of integers belonging to the interval).
输入格式
The first line contains a single integer $t$ ( $1 \le t \le 10^4$ ) — the number of test cases.
The only line of the description of each test case contains one integer $n$ ( $1 \leq n \leq 10^{18}$ ).
The only line of the description of each test case contains one integer $n$ ( $1 \leq n \leq 10^{18}$ ).
输出格式
For each test case, print a single integer: the maximum size of a valid interval.
输入输出样例
输入 #1
10 1 40 990990 4204474560 169958913706572972 365988220345828080 387701719537826430 620196883578129853 864802341280805662 1000000000000000000
输出 #1
1 2 3 6 4 22 3 1 2 2
In the first test case, a valid interval with maximum size is $[1, 1]$ (it's valid because $n = 1$ is a multiple of $1$ ) and its size is $1$ .
In the second test case, a valid interval with maximum size is $[4, 5]$ (it's valid because $n = 40$ is a multiple of $4$ and $5$ ) and its size is $2$ .
In the third test case, a valid interval with maximum size is $[9, 11]$ .
In the fourth test case, a valid interval with maximum size is $[8, 13]$ .
In the seventh test case, a valid interval with maximum size is $[327869, 327871]$ .
In the second test case, a valid interval with maximum size is $[4, 5]$ (it's valid because $n = 40$ is a multiple of $4$ and $5$ ) and its size is $2$ .
In the third test case, a valid interval with maximum size is $[9, 11]$ .
In the fourth test case, a valid interval with maximum size is $[8, 13]$ .
In the seventh test case, a valid interval with maximum size is $[327869, 327871]$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted