| 记录编号 | 
        359520 | 
        评测结果 | 
        AAAAA | 
    
    
        | 题目名称 | 
        50.[NOIP 2002]选数 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         kZime | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.001 s  | 
    
    
        | 提交时间 | 
        2016-12-23 11:30:14 | 
        内存使用 | 
        0.31 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,a[21],sum,s;
bool is_p(int x){
	if(x<2)return 0;
	for(int i=2;i*i<=x;i++){
		if(!(x%i))return 0;
	}
	return 1;
}
void dfs(int i,int k){
	if(k>m){
		if(is_p(sum))s++;
		return ;
	}
	else for(;i<n;i++){
		sum+=a[i];
		dfs(i+1,k+1);
		sum-=a[i];
	}
}
int main(){
	ios::sync_with_stdio(false);
	freopen("choose.in","r",stdin);
	freopen("choose.out","w",stdout);
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>a[i];
	dfs(0,1);
	cout<<s;
	return 0;
}