CF1855B.Longest Divisors Interval

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Given a positive integer nn, find the maximum size of an interval [l,r][l, r] of positive integers such that, for every ii in the interval (i.e., lirl \leq i \leq r), nn is a multiple of ii.

Given two integers lrl\le r, the size of the interval [l,r][l, r] is rl+1r-l+1 (i.e., it coincides with the number of integers belonging to the interval).

给定一个正整数 nn,求满足以下条件的区间 [l,r][l, r](其中 l,rl, r 均为正整数)的最大长度:对区间内的每个整数 ii(即对所有满足 lirl \leq i \leq rii),nn 都是 ii 的倍数。

对于两个整数 lrl \le r,区间 [l,r][l, r] 的长度定义为 rl+1r - l + 1(即等于该区间内所含整数的个数)。

输入格式

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases.

The only line of the description of each test case contains one integer nn (1n10181 \leq n \leq 10^{18}).

第一行包含一个整数 tt1t1041 \le t \le 10^4)—— 测试用例的数量。

每个测试用例的描述仅有一行,包含一个整数 nn1n10181 \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][1, 1] (it's valid because n=1n = 1 is a multiple of 11) and its size is 11.

In the second test case, a valid interval with maximum size is [4,5][4, 5] (it's valid because n=40n = 40 is a multiple of 44 and 55) and its size is 22.

In the third test case, a valid interval with maximum size is [9,11][9, 11].

In the fourth test case, a valid interval with maximum size is [8,13][8, 13].

In the seventh test case, a valid interval with maximum size is [327869,327871][327869, 327871].

在第一个测试用例中,最大尺寸的有效区间为 [1,1][1, 1](该区间有效,因为 n=1n = 111 的倍数),其尺寸为 11

在第二个测试用例中,最大尺寸的有效区间为 [4,5][4, 5](该区间有效,因为 n=40n = 404455 的倍数),其尺寸为 22

在第三个测试用例中,最大尺寸的有效区间为 [9,11][9, 11]

在第四个测试用例中,最大尺寸的有效区间为 [8,13][8, 13]

在第七个测试用例中,最大尺寸的有效区间为 [327869,327871][327869, 327871]

输入解题思路,AI测评打分。不知道怎么写?

首页