302329: CF448E. Divisors

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Divisors

题意翻译

我们的冠军 Bizon 不仅是一个友(you)好(qu)的程序猿,也是一只严谨的程序员。~~(无视量词蟹蟹)~~ 定义函数 $f(a)$ ( $a$ 是一个不定长度的整数集合,这里用 $n$ 表示它的长度)的返回值为如下的另一集合 $b$ ,它包含 $a$ 中的第一个数 $a_1$ 的所有约数,第二个数 $a_2$ 的所有约数,……,一直到第 $n$ 个数 $a_n$ 的所有约数(每一个数的约数要求从小到大排序)。 例如:$f[2,9,1]=[1,2,1,3,9,1]$,$f[1,2,4,8]=[1,1,2,1,2,4,1,2,4,8]$。 然后,定义集合 $X_i$,对于任意正整数 $X$ ,$X_0=[x]$,(即 $X_0$ 只包含一个数 $x$ )。对于任意正整数 $i$ ,$X_i=f(X_{i-1})$。 例如:当 $X=6$ 时,我们可以得到 $X_0= [ 6 ] $,$X_1=f(6)=[1,2,3,6]$ ,$X_2=f[1,2,3,6]=[1,1,2,1,3,1,2,3,6]$ 。 输入会给出两个正整数 $X$ 和 $k$ ,输出集合 $X_k$。考虑到结果可能很大,只要输出这个集合的前 $10^5$个数即可(如果有的话)。

题目描述

Bizon the Champion isn't just friendly, he also is a rigorous coder. Let's define function $ f(a) $ , where $ a $ is a sequence of integers. Function $ f(a) $ returns the following sequence: first all divisors of $ a_{1} $ go in the increasing order, then all divisors of $ a_{2} $ go in the increasing order, and so on till the last element of sequence $ a $ . For example, $ f([2,9,1])=[1,2,1,3,9,1] $ . Let's determine the sequence $ X_{i} $ , for integer $ i $ $ (i>=0) $ : $ X_{0}=[X] $ ( $ [X] $ is a sequence consisting of a single number $ X $ ), $ X_{i}=f(X_{i-1}) $ $ (i>0) $ . For example, at $ X=6 $ we get $ X_{0}=[6] $ , $ X_{1}=[1,2,3,6] $ , $ X_{2}=[1,1,2,1,3,1,2,3,6] $ . Given the numbers $ X $ and $ k $ , find the sequence $ X_{k} $ . As the answer can be rather large, find only the first $ 10^{5} $ elements of this sequence.

输入输出格式

输入格式


A single line contains two space-separated integers — $ X $ $ (1<=X<=10^{12}) $ and $ k $ $ (0<=k<=10^{18}) $ .

输出格式


Print the elements of the sequence $ X_{k} $ in a single line, separated by a space. If the number of elements exceeds $ 10^{5} $ , then print only the first $ 10^{5} $ elements.

输入输出样例

输入样例 #1

6 1

输出样例 #1

1 2 3 6 

输入样例 #2

4 2

输出样例 #2

1 1 2 1 2 4 

输入样例 #3

10 3

输出样例 #3

1 1 1 2 1 1 5 1 1 2 1 5 1 2 5 10 

Input

题意翻译

我们的冠军 Bizon 不仅是一个友(you)好(qu)的程序猿,也是一只严谨的程序员。~~(无视量词蟹蟹)~~ 定义函数 $f(a)$ ( $a$ 是一个不定长度的整数集合,这里用 $n$ 表示它的长度)的返回值为如下的另一集合 $b$ ,它包含 $a$ 中的第一个数 $a_1$ 的所有约数,第二个数 $a_2$ 的所有约数,……,一直到第 $n$ 个数 $a_n$ 的所有约数(每一个数的约数要求从小到大排序)。 例如:$f[2,9,1]=[1,2,1,3,9,1]$,$f[1,2,4,8]=[1,1,2,1,2,4,1,2,4,8]$。 然后,定义集合 $X_i$,对于任意正整数 $X$ ,$X_0=[x]$,(即 $X_0$ 只包含一个数 $x$ )。对于任意正整数 $i$ ,$X_i=f(X_{i-1})$。 例如:当 $X=6$ 时,我们可以得到 $X_0= [ 6 ] $,$X_1=f(6)=[1,2,3,6]$ ,$X_2=f[1,2,3,6]=[1,1,2,1,3,1,2,3,6]$ 。 输入会给出两个正整数 $X$ 和 $k$ ,输出集合 $X_k$。考虑到结果可能很大,只要输出这个集合的前 $10^5$个数即可(如果有的话)。

加入题单

算法标签: