| 记录编号 | 
        584513 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        2902.博士的密码 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         ┭┮﹏┭┮ | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.062 s  | 
    
    
        | 提交时间 | 
        2023-11-13 14:59:01 | 
        内存使用 | 
        1.15 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include <bits/stdc++.h>
using namespace std;
const int N = 110;
long long n,m,ans;
long long a[N];
map<long long,int>mp;
void sou1(int x,long long u){
    if(x == n/2+1){
        mp[u]++;//
        return;
    }
    sou1(x+1,u+a[x]);
    sou1(x+1,u);
}
void sou2(int x,long long u){
    if(x == n+1){
        ans += mp[m-u];// 
        return;
    }
    sou2(x+1,u+a[x]);
    sou2(x+1,u);
}//两次dfs求得 
int main(){
    freopen("password1.in","r",stdin);
    freopen("password1.out","w",stdout);
    scanf("%lld%lld",&n,&m);
    for(int i = 1;i <= n;i++)scanf("%lld",&a[i]);
    sou1(1,0);
    sou2(n/2+1,0);
    printf("%lld",ans);
    
    return 0;
    
}