Preparando MOJI

k-Factorization

2000ms 262144K

Description:

Given a positive integer n, find k integers (not necessary distinct) such that all these integers are strictly greater than 1, and their product is equal to n.

Input:

The first line contains two integers n and k (2 ≤ n ≤ 100000, 1 ≤ k ≤ 20).

Output:

If it's impossible to find the representation of n as a product of k numbers, print -1.

Otherwise, print k integers in any order. Their product must be equal to n. If there are multiple answers, print any of them.

Sample Input:

100000 2

Sample Output:

2 50000 

Sample Input:

100000 20

Sample Output:

-1

Sample Input:

1024 5

Sample Output:

2 64 2 2 2 

Informação

Codeforces

Provedor Codeforces

Código CF797A

Tags

implementationmathnumber theory

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 09:14:36

Relacionados

Nada ainda