suppose we are given two integers M and N such that k1+k2+k3....kM= N
where k1,k2,... are non-negative integers. now we have to print all possible unique combinations along with the numbers of occurence of each combination. for example M= 3 and N=7 so the combinations goes like-
007 3 (3 means 007, 070, 700, 0+0+7=7)
016 6
025 6
034 6
115 3
223 3
...... and so on...
now what is the fastest way to output all the combinations given the integers M and N. M and N can be large...
What exactly do you mean by "large"?
M can be uptu 400 and N can be uptu 800.
It's impossible to generate all possible partitions — the count of combinations is too big. If that's not an exact statement of a task you need to solve, could you describe it or provide a link?
actually the task is related to this problem
It's prohibited to discuss anything about problem solving now by the rules of that contest.