F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Math teacher's homework

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 749    Accepted Submission(s): 292


Problem Description
Mr. Furion is a math teacher. His students are very lazy and they do not like to do their homework. One day, Mr. Furion decides to give them a special problem in order to see whether his students are talents in math or they are just too lazy to do their homework. The problem is:


Given an integer k, n integers m1,m2¡­mn, and a formula below:

X1 xor X2 xor X3¡­ xor Xn = k

Please figure out that how many integral solutions of the formula can satisfy:

0<=Xi<=mi (i=1¡­n)
 

Input
There are at most 100 test cases.

The first line of each test case contains two integers n and k. The second line of each test contains n integers: m1,m2¡­mn. The meaning of n,k, m1,m2¡­mn are described above. (1<=n<=50,0<=k,m1,m2¡­mn<=2^31-1 )

The input is ended by ¡°0 0¡±.
 

Output
You should output a integer for each test case, which is the number of solutions. As the number might be very large, you should only output the number modulo 1000000003.
 

Sample Input
11 2047 1024 512 256 128 64 32 16 8 4 2 1 10 2047 1024 512 256 128 64 32 16 8 4 2 0 0
 

Sample Output
1 0
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-24 17:09:10, Gzip enabled