You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
633 B
C++
29 lines
633 B
C++
#include <cstdio>
|
|
#include <cstring>
|
|
using namespace std;
|
|
typedef long long ll;
|
|
const int N=43,M=1<<20;
|
|
ll dp[N][M];
|
|
int a[N];
|
|
int main()
|
|
{
|
|
int T,n,m,t=0;
|
|
scanf("%d",&T);
|
|
while(T--)
|
|
{
|
|
scanf("%d%d",&n,&m);
|
|
for(int i=1; i<=n; i++)
|
|
scanf("%d",a+i);
|
|
memset(dp,0,sizeof(dp));
|
|
dp[0][0]=1;
|
|
for(int i=1; i<=n; i++)
|
|
for(int j=0; j<M; j++)
|
|
dp[i][j]=dp[i-1][j]+dp[i-1][j^a[i]];
|
|
ll ans=0;
|
|
for(int i=m; i<M; i++)
|
|
ans+=dp[n][i];
|
|
printf("Case #%d: %lld\n",++t,ans);
|
|
}
|
|
return 0;
|
|
}
|