GLCCDM
Time limit1sMemory limit1024 MB
Given A, B, and K, the task asks for K distinct positive integers with gcd equal to A and lcm equal to B, or -1 if none exist.
- Level
Medium6 of 10
- Topics
- Number theory, Math, Combinatorics
- Solved
- No attempts yet
Problem
Find a sequence of distinct positive integers that satisfies both and .
Input
The first line contains positive integers , , and separated by spaces. (; )
Output
Print positive integers separated by spaces, in any order. If several sequences satisfy the conditions, print any one of them. If no sequence satisfies the conditions, print only -1.
Hint
is the largest positive integer that divides every , and is the smallest positive integer that every divides.