当前位置: 首页 > news >正文

B. Longest Divisors Interval

time limit per test

2 seconds

memory limit per test

256 megabytes

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., l≤i≤rl≤i≤r), nn is a multiple of ii.

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

Input

The first line contains a single integer tt (1≤t≤1041≤t≤104) — the number of test cases.

The only line of the description of each test case contains one integer nn (1≤n≤10181≤n≤1018).

Output

For each test case, print a single integer: the maximum size of a valid interval.

Example

Input

Copy

 

10

1

40

990990

4204474560

169958913706572972

365988220345828080

387701719537826430

620196883578129853

864802341280805662

1000000000000000000

Output

Copy

1
2
3
6
4
22
3
1
2
2

Note

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].

解题说明:此题是一道数学题,给出一整数n,要求在1到n内找出一连续区间,使区间内每个数都是n的因数,求满足要求的最长区间。可以从1~n遍历,统计有多少个i能被n整除,遇到不能被整除的就输出答案即可。

#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{int t;cin >> t;while (t--){long long n;cin >> n;int cnt = 0;int ans = 0;for (int i = 1; i <= n; i++){if (n % i == 0){cnt++;}else{break;}}cout << cnt << endl;}return 0;
}

http://www.lryc.cn/news/538103.html

相关文章:

  • 前端与后端的对接事宜、注意事项
  • 【第13章:自监督学习与少样本学习—13.2 少样本学习(FSL)与元学习(Meta-Learning)的基础理论与应用案例】
  • 函数防抖和节流
  • linux--关于linux文件IO(2) open、read、lseek、stat
  • 利用xtquant高效获取财务数据:量化分析的重要补充
  • Unity UI个人总结
  • Javascript的数据类型
  • Day3 25/2/16 SUN
  • 欧洲分组加密算法之Kasumi
  • vue使用v-chart的实践心得
  • Endnote使用笔记——持续更新
  • Tetragon:一款基于eBPF的运行时环境安全监控工具
  • CAS单点登录(第7版)23.Webflow 管理
  • word文档中标题的自动编号问题
  • kkFileView二开之pdf转图片接口
  • 利用亚马逊云科技RDS for SQL Server配置向量数据存储
  • vLLM 部署 DeepSeek 大模型避坑指南
  • 本地部署MindSearch(开源 AI 搜索引擎框架),然后上传到 hugging face的Spaces——L2G6
  • 【大模型系列】Windows系统上运行大语言模型方式
  • Linux Mem -- Where the mte store and check in the real hardware platform
  • 连锁企业管理系统的五大核心功能
  • Docker配置镜像加速-解决黑马商城部署Mysql失败问题
  • Cherno C++ P54 内存:栈与堆
  • 对项目交接的一些思考
  • 【PYTORCH】官方的turoria实现中英文翻译
  • 【算法与数据结构】并查集详解+题目
  • 【动态路由】系统web url整合系列【springcloud-gateway实现】【不改hosts文件版】组件一:多个Eureka路由过滤器
  • Mybatis-扩展功能
  • 基于SpringBoot实现的大学社团平台系统实现功能六
  • 电子电气架构 --- 机器学习推动车载雷达的发展