Uestc_ Onsen Hotel Cdoj 878

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.