当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3986:Math teacher's homework

题目描述
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)
输入解释
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 case 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<=231-1 )
The input is ended by “0 0”
输出解释
You should output an 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.
输入样例
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
输出样例
1
0

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3986

最后修改于 2020-10-29T07:17:26+00:00 由爬虫自动更新

共提交 1

通过率 100.0%
时间上限 内存上限
1000 65536