编程介的小学生 2018-12-16 16:14 采纳率: 20.5%
浏览 349
已采纳

这个问题,用C语言计算所有的整数的xor怎么才能计算呢?

Problem Description
BrotherK likes playing GALGAME, now he wants to design a GALGAME.

Ery has designed N roles for his game, each role can be described as four integers: name, face, character, magic(Just a special parameter, don't care about it). BrotherK need to select some roles for his game, and there are some rules:

Assume BrotherK has selected K roles, i-th role's magic is Mi, the equation should be hold: M1 xor M2 xor .. xor MK = 0. (xor means exclusive or, (a xor b) means (a ^ b) in C/C++/Java).

There is not any pair of selected role has same face.

For each character(except there is not any role with the character), BrotherK should select at least one role with the character.

Now, BrotherK wants to know there are how many ways to choose roles.

Input
The first line contains a single integer T, indicating the number of test cases.

Each test case begins with one integers N, indicating the number of roles designed by Ery.Following N lines, i-th line contains three integers
Facei, Characteri and Magici, describing the role whose Name is i.

T is about 100, in most case, N is small.

1 ≤ N ≤ 32.

1 ≤ Facei,Characteri ≤ N.

0 ≤ Magici ≤ 100000.

Output
For each test, print one line.

The line contains a number indicating the number of BrotherK's ways to choose roles.

Sample Input
2
3
1 2 1
2 1 1
1 1 1
5
1 2 1
1 1 2
1 2 2
2 1 1
3 2 2

Sample Output
1
2

  • 写回答

1条回答 默认 最新

  • threenewbee 2019-08-12 23:56
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘