1749: Polygons2

内存限制:128 MB 时间限制:10.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

You are given N line segments numbered 1 to N. The lengths of these segments are betwenn 1 and 50000. 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.

输入

the input file contain T cases; each case contains 3 lines, the 1st line is n(n<=50); the 2nd line is n segments lengths;the 3rd line is K(3<=K<=10);

输出

the output contains T lines; each line is one number: the number of different polygons you can compose.

样例输入 复制

3
4
1 1 1 1
3
4
2 3 4 5
3
6
4 4 4 2 2 2
3

样例输出 复制

4
3
11

来源/分类