A - A Hard Problem

Given a positive integer n, you need to find out the minimum integer k such that for any subset T of the set {1,2,⋯,n} of size k, there exist two different integers u,v in T,u,v∈T ,that u is a factor of v.

Input

The first line contains an integer T(1≤T≤10^5) indicating the number of test cases.

Each of the following T lines contains an integer n (2≤n≤10^9) describing a test case.

Output

For each test case, output a line containing an integer which indicates the answer.

Sample Input

4
2
3
4
5

Sample Output

2
3
3
4

题意解析:

给定一个数n,然后在{1,2,3,....,n}中找出最小的子集,这个子集内需要有数u和v,然后满足u是v的因子,输出这个子集的大小

是任意长度为K的子集都存在两个数u,v,满足u是v的因子。
例如1 . 2. 3, 如果是2的话,那么2,3就不符合, 所以得是3.

要在k里能找到两个互为2倍数关系的,或者也可以直接列举出前几个的结果,可以得到一个通项 (n+1)/2+1,是个水题。

AC代码:

#include<iostream>
using namespace std;
int main() {
	int t;
	cin>>t;
	while(t--) {
		int n;
		cin>>n;
		cout<<(n+1)/2+1<<endl;
	}
	return 0;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值