Confused101's blog

By Confused101, history, 11 years ago, In English

Can anyone help me with this problem:

Problem: Number of Solution of equation x_1 + x_2 + x_3 + ... x_k = N
for all i: x_i>=0 and x_i<=x_(i+1) constraints:[N<= 10^9 k<=10]

[basically non-decreasing solutions]

  • Vote: I like it
  • +6
  • Vote: I do not like it

»
11 years ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Generate the solution for small N and K and look for a recurrence relation.

»
11 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

The 'x' values must be integers?

»
11 years ago, hide # |
 
Vote: I like it +22 Vote: I do not like it

Hint 1: Prove that the equation is equivalent to y_1 + 2y_2 + ... + ky_k = N. Hint 2: Digit DP. Represent each y_i as a binary number and fix the parity.