The sky floats a snowflake, this is a pure white world.
In the sky under the hot Spring hotel, the snow dish has been drunk in the side, winter horse and Chunch looked at talking about the snow dishes, decided to find a little play to spend this happy evening.
This hotel provides a special game, the game has n cards, each written with a number, the number may be the same or different, winter horse and Chunch can take out any Zhang (also can not take, was one of the cards, another person must not be able to take. ), the respective score for their hands on the cards on the number of XOR.
Chunch as a boy, feel that they should let the girls, decided only their own score than the winter horse when the count of their own win, but nosy he still want to know how many kinds of law, can let winter horse win.
Input
The first behavior is an integer n, which represents the number of cards. (1≤n≤)
Second lineNAn integer,ai A number representing the first card. (0≤ ai≤ 100)
Output
An integer that indicates the number of schemes the winter horse can win over Chunch.
Sample Input and output
| Sample Input |
Sample Output |
255 68 |
5 |
Problem Solving Report
Simple dp,f (i,j) means the winter horse is I, Chunch is the number of J
#include <iostream>#include<algorithm>#include<cstring>#include<cstdio>typedefLong Longll;using namespacestd;Const intMAXN = -+ the;intdp[ -+5][maxn+ -][maxn+ -],a[ -+5];intMainintargcChar*argv[]) { intN; CIN>>N; for(inti =1; I <= N; + + i) Cin >>A[i]; Memset (DP,0,sizeof(DP)); ll ans=0; dp[0][0][0] =1; for(inti =1; I <= -; ++i) for(intj =0; J <= -; ++j) for(intK =0; K <= -; ++k) {Dp[i][j][k]+ = dp[i-1][j][k]; Dp[i][j^a[i]][k] + = dp[i-1][j][k]; Dp[i][j][k^a[i]] + = dp[i-1][j][k]; } for(inti =0; I <= -; ++i) for(intj =0; J <= -; ++j)if(I >=j) Ans+=Dp[n][i][j]; cout<< ans <<Endl; return 0;}
Uestc_ Onsen Hotel Cdoj 878