| 记录编号 | 
        94810 | 
        评测结果 | 
        AAAAA | 
    
    
        | 题目名称 | 
        50.[NOIP 2002]选数 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         我叫方旭 | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.019 s  | 
    
    
        | 提交时间 | 
        2014-04-02 20:40:50 | 
        内存使用 | 
        0.19 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<fstream>
#include<cmath>
using namespace std;
ifstream in("choose.in");
ofstream out("choose.out");
int const zd=21;
int n;
int k;
int x[zd];
int ans=0;
bool pd(int w)
{
	for(int q=2;q<=sqrt(w);q++)
	{
		if(w%q==0)
		{
			return false;
		}
	}
	return true;
}
void zh(int a,int b,int c)
{
	if(b==k)
	{
		if(pd(c))
		{
			ans++;
		}
		return;
	}
	for(int q=a;q<=n;q++)
		zh(q+1,b+1,c+x[q]);
}
int main()
{
	in>>n;
	in>>k;
	for(int q=1;q<=n;q++)
		in>>x[q];
	zh(1,0,0);
	out<<ans;
	return 0;
}