Problem Statement | |||||||||||||
You are given N line segments numbered 1 to N. The lengths of these segments are given in the int[] segments. Compose a convex K-sided polygon, where each side is one of the given segments. Each segment can only be used once in the polygon.
Return the number of different polygons you can compose. Two polygons are considered different if there exists a segment i such that one of the polygons contains segment i but the other polygon does not. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | A convex polygon can be constructed from a set of segments if the length of each segment from this set is strictly less than the sum of lengths of the remaining segments. | ||||||||||||
Constraints | |||||||||||||
- | segments will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | K will be between 3 and 10, inclusive. | ||||||||||||
- | Each element of segments will be between 1 and 50,000, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|