1
$\begingroup$

In the following equation with unknown integers $x_i$, $1 \leq i \leq N$, the sum of all those integers are $R$. A constraint is added to each integer such that $Min_i \leq x_i \leq Max_i$. The question asks for the total number of integer solution to this equation.

$x_1+x_2+\dots+x_n=R$

(It's relatively easy to deal with lower bound, but how to find the total number of integer solution that any of the upper bound is violated so as to exclude them?)

Please advice. Thanks.

$\endgroup$
1
  • 1
    $\begingroup$ See this question and its answer for a specific numerical example. See this question and its answer for a general solution. $\endgroup$ Commented Jan 22, 2015 at 23:28

0

Browse other questions tagged .