/ OPS / 题库 /

El Dorado

El Dorado

#描述#
Bruce Force has gone to Las Vegas, the El Dorado for gamblers. He is interested especially in one betting game, where a machine forms a sequence of n numbers by drawing random numbers. Each player should estimate beforehand, how many increasing subsequences of length k will exist in the sequence of numbers.<br><br>A subsequence of a sequence a[1], ..., a[n] is defined as a[i[1]], ..., a[i[m]], where 1 ≤ i[1] < i[2] < ... < i[m] ≤ n. The subsequence is increasing, if a[i[j-1]] < a[i[j]] for all 1 < j ≤ m.<br><br>Bruce doesn't trust the Casino to count the number of increasing subsequences of length k correctly. He has asked you if you can solve this problem for him.

#格式#
##输入格式##
The input contains several test cases. The first line of each test case contains two numbers n and k (1 ≤ k ≤ n ≤ 100), where n is the length of the sequence drawn by the machine, and k is the desired length of the increasing subsequences. The following line contains n pairwise distinct integers ai (-10000 ≤ a[i] ≤ 10000 ), where ai is the i-th number in the sequence drawn by the machine.

The last test case is followed by a line containing two zeros.

##输出格式##
For each test case, print one line with the number of increasing subsequences of length k that the input sequence contains. You may assume that the inputs are chosen in such a way that this number fits into a 64 bit signed integer.

#样例1#
##样例输入1##

10 5
1 2 3 4 5 6 7 8 9 10
3 2
3 2 1
0 0

##样例输出1##

252
0

#限制#
1000ms
65536KB

#提示#

#来源#

信息

ID
1560
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者