It is Restricted Integer Partitions, but with maximum number.
Question
Three positive integers are given. First number is number to divide, second number is length of partition, and third number is maximum number. First number is always largest, and bigger than other two.
For example, 5, 2, 3
. Then, make partition of 5
which have 2
parts, and maximum number you can use is 3
. Note that you don't have to use 3
: maximum number can be 2
or 1
.
In this case, there is only one partition : 3, 2
.
Partition is unordered : which means 3 + 2
and 2 + 3
is same.
But in case like 7, 3, 3
, there are two partition : 3, 3, 1
and 3, 2, 2
.
To make it sure, You can use third number as largest number, but you don't have to use it. So 5, 4, 3
is true.
Question is : Is there are more than one partition, given length and maximum number?
Output is True
or 1
or whatever you want when there is only one partition, and False
or 0
or whatever you want where there are more than one partition, or no partition.
Winning condition
This is code golf, so code with shortest byte wins.
Examples
Input -> Output
7, 6, 2 -> True (2+1+1+1+1+1) : 1 partitions
5, 4, 4 -> True (2+1+1+1) : 1 partitions
5, 4, 3 -> True (2+1+1+1) : 1 partitions
5, 4, 2 -> True (2+1+1+1) : 1 partitions
5, 3, 2 -> True (2+2+1) : 1 partitions
7, 2, 3 -> False no partitions
7, 2, 2 -> False no partitions
7, 2, 1 -> False no partitions
9, 5, 3 -> False (3+3+1+1+1), (3+2+2+1+1), (2+2+2+2+1) : 3 partitions
6, 3, 3 -> False (3+2+1), (2+2+2) : 2 partitions
7, 6, 2 -> True
? With dividing 7 into 6 parts, I only see 2+1+1+1+1+1. Also, you say that the first number is always the largest, but it's not with2, 7, 3
. \$\endgroup\$ – xnor May 26 '19 at 6:51