您的位置:首页 > 其它

Zhu and 772002

2016-08-15 09:53 295 查看


Zhu and 772002

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 458    Accepted Submission(s): 151


[align=left]Problem Description[/align]
Zhu and 772002 are both good at math. One day, Zhu wants to test the ability of 772002, so he asks 772002 to solve a math problem.

But 772002 has a appointment with his girl friend. So 772002 gives this problem to you.

There are n
numbers a1,a2,...,an.
The value of the prime factors of each number does not exceed
2000,
you can choose at least one number and multiply them, then you can get a number
b.

How many different ways of choices can make b
is a perfect square number. The answer maybe too large, so you should output the answer modulo by
1000000007.
 

[align=left]Input[/align]
First line is a positive integer
T
, represents there are T
test cases.

For each test case:

First line includes a number n(1≤n≤300),next
line there are n
numbers a1,a2,...,an,(1≤ai≤1018).
 

[align=left]Output[/align]
For the i-th test case , first output Case #i: in a single line.

Then output the answer of i-th test case modulo by
1000000007.
 

[align=left]Sample Input[/align]

2
3
3 3 4
3
2 2 2

 

[align=left]Sample Output[/align]

Case #1:
3
Case #2:
3

 

[align=left]Author[/align]
UESTC
 

[align=left]Source[/align]
2016中国大学生程序设计竞赛 - 网络选拔赛

题解:

300个最大质因数小于2000的数,选若干个它们的乘积为完全平方数有多少种方案。

合法方案的每个数的质因数的个数的奇偶值异或起来为0。

比如12=2^2*3,对应的奇偶值为01(2的个数是偶数为0,3的个数是奇数为1),3的对应奇偶值为01,于是12*3是完全平方数。

然后异或方程组就是:

a11x1+a12x2+...+a1nxn=0

a21x1+a22x2+...+a2nxn=0

...

an1x1+an2x2+...+annxn=0

aij:第i个质数(2000内有303个质数)在第j个数里是奇数个则为1,否则为0。

xi:第i个数(最多300个数)被选则为1,否则为0。

求出有多少种解即可。(异或方程组高斯消元求秩,然后解就有2^(n-rank)种,减去全为0的解)

?
  原来是白书上的题(160页)I good vagetable a!

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: