测试用例
5 2 8
1 7 2 5 4
#include<iostream>
#include<string.h>
using namespace std;
int m, r, n;
int a[100];
int visit[100] = {0};
int sum = 0;
void traceback(int s,int price,int next){
if(s == r){
if (price > n)
sum++;
return ;
}
for (int i = next ;i < m;i++){
if (visit[i] != 1){
visit[i] = 1;
traceback(s + 1 ,price + a[i],i);
visit[i] = 0;
}
}
}
int main(){
cin>>m>>r>>n;
for (int i = 0;i < m;i++){
cin>> a[i];
}
traceback(0,0,0);
cout<<sum;
return 0;
}