Problem 2: Find the Numbers, (K Narayan Kumar, CMI)
This is a rather simple problem to describe. You will be given three numbers S, P and k. Your task is to find if there are integers n1, n2,...,nk such that n1 + n2 +...+ nk = S, n1 * n2 * ... * nk = P. If such integers exist, print them out. If no such sequence of integers exist, then print "NO".
For example if S=11, P=48 and k=3 then 3, 4 and 4 is a solution. On the other hand, if S=11, P=100 and k=3, there is no solution and you should print "NO".
A single line with three integers S, P and k.
A single word "NO" or a seqence of k integers n1, n2,..., nk on a single line. (The ni's must add up to S and their product must be P).
You may assume that 1 ≤ k ≤ 4, 1 ≤ S ≤ 1000 and 1 ≤ P ≤ 1000.
We now illustrate the input and output formats using some examples.
Sample input 1:
11 48 3
Sample output 1:
3 4 4
Sample input 2:
11 100 3
Sample output 2:
|CPU Timelimit:||3 seconds|