| 比赛 | 
    20231007练习 | 
    评测结果 | 
    RRRRRRRRRRRRRRR | 
    | 题目名称 | 
    异或和与与运算 | 
    最终得分 | 
    0 | 
    | 用户昵称 | 
    ┭┮﹏┭┮ | 
    运行时间 | 
    0.000 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.00 MiB  | 
    | 提交时间 | 
    2023-10-07 19:33:46 | 
显示代码纯文本
#include <bits/stdc++.h> 
using namespace std;
int n;
int a[60],ans;
void sou(int x,int y,int i){
    if(i == n+1){
        if(x == y)ans++;  
        return;
    }
    sou(x^a[i],y&a[i],i+1);
    sou(x,y,i+1);
}
int main(){
    freopen("mgrid.in","r",stdin);
    freopen("mgrid.out","w",stdout);
    scanf("%d",&n);
    for(int i = 1;i <= n;i++){
        scanf("%d",&a[i]);
    }
    sou(0,(1<<20)-1,1);
    printf("%d\n",ans);
    
    return 0;
    
}