编程介的小学生 2019-02-20 17:04 采纳率: 20.5%
浏览 458

C语言里,这个多个整数xor的问题,是如何实现的,C语言

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条回答 默认 最新

  • yrhdsp 2019-02-20 17:08
    关注

    model name : AMD Opteron(tm) Processor 6136
    stepping : 1
    cpu MHz : 800.000
    cache size : 512 KB
    physical id : 0
    siblings : 8
    core id : 0

    评论

报告相同问题?

悬赏问题

  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?