DP专题练习4

选数异或

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int N = 1e5 + 10,mod = 998244353;
int n, x;
int dp[N][70];//dp[i][j]表示选到前i个数,结果为j的方案数
void solve(){
	cin >> n >> x;
	dp[0][0] = 1;
	for(int i = 1; i <= n ; i ++){
		int y ; cin >> y;
		for(int j = 0 ; j <= 63 ; j ++){
			dp[i][j] = (dp[i-1][j] + dp[i-1][j^y])%mod;
		}
	}
	cout << dp[n][x];
}
signed main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	int _ = 1;
	//cin >> _;
	while(_--) solve();
	return 0;
}
posted @ 2024-03-22 13:38  xde_yt  阅读(0)  评论(0编辑  收藏  举报  来源