CF1333F.Kate and imperfection
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Kate has a set S of n integers ${1, \dots, n} $.
She thinks that imperfection of a subset M⊆S is equal to the maximum of gcd(a,b) over all pairs (a,b) such that both a and b are in M and a=b.
Kate is a very neat girl and for each k∈2,…,n she wants to find a subset that has the smallest imperfection among all subsets in S of size k. There can be more than one subset with the smallest imperfection and the same size, but you don't need to worry about it. Kate wants to find all the subsets herself, but she needs your help to find the smallest possible imperfection for each size k, will name it Ik.
Please, help Kate to find I2, I3, ..., In.
凯特有一个由 n 个整数 {1,…,n} 构成的集合 S。
她定义子集 M⊆S 的不完美度(imperfection)为:对所有满足 a,b∈M 且 a=b 的数对 (a,b),其 gcd(a,b) 的最大值。
凯特是一位非常细致的女孩。对于每个 k∈{2,…,n},她希望在 S 的所有大小为 k 的子集中,找出不完美度最小的那个子集。可能存在多个具有相同最小不完美度且大小同为 k 的子集,但这无需你关心。凯特打算自己找出所有这些子集,但她需要你的帮助——对每个大小 k,求出可能的最小不完美度,记作 Ik。
请帮助凯特求出 I2, I3, ..., In。
输入格式
The first and only line in the input consists of only one integer n (2≤n≤5⋅105) — the size of the given set S.
输入仅有一行,包含一个整数 n(2≤n≤5⋅105)——即给定集合 S 的大小。
输出格式
Output contains only one line that includes n−1 integers: I2, I3, ..., In.
输出仅包含一行,其中包括 n−1 个整数:I2、I3、…、In。
输入输出样例
输入#1
2
输出#1
1
输入#2
3
输出#2
1 1
说明/提示
First sample: answer is 1, because gcd(1,2)=1.
Second sample: there are subsets of S with sizes 2,3 with imperfection equal to 1. For example, 2,3 and 1,2,3.
第一个样例:答案为 1,因为 gcd(1,2)=1。
第二个样例:集合 S 中存在大小为 2 和 3 的子集,其不完美度等于 1。例如,{2,3} 和 {1,2,3}。
输入解题思路,AI测评打分。不知道怎么写?