F - Four-tuples-“浪潮杯”第九届山东省ACM大学生程序设计竞赛重现赛

链接:https://www.nowcoder.com/acm/contest/123/F
来源:牛客网

题目描述
Given ,please count the number of four-tuples such thatand
The answer should modulo109+7 before output.
输入描述:
The input consists of several test cases. The first
line gives the number of test cases,T(1≤T≤106).

For each test case, the input contains one line
with 8 integers,.
输出描述:
For each test case, output one line containing one
integer, representing the answer.
示例1
输入

1
1 1 2 2 3 3 4 4
输出

1

[分析]
容斥原理。就是麻烦。
ans=所有都不相等-两个相等+三个相等+两对两个相等-四个相等。

猜你喜欢

转载自blog.csdn.net/q435201823/article/details/80376053