Zhu and 772002

来源:互联网 发布:淘宝产品图片尺寸留白 编辑:程序博客网 时间:2024/05/29 18:12

Zhu and 772002


Problem Description

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.

Input

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).

Output

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.

Sample Input

2
3
3 3 4
3
2 2 2

Sample Output

Case #1:
3
Case #2:
3


#include <stdio.h>int main(int argc, char *argv[]){    long int num[26],i,t,temp,sum,n;    char str[100009],*p;    scanf("%ld",&t);    n=1;    while(t--)    {        scanf("%s",str);        p=str;        sum=0;        for(i=0;i<26;i++)        {            num[i]=0;        }        while(*p!='\0')        {            temp=*p-97;            if(num[temp]==0)            {                num[temp]=1;            }            p++;        }        for(i=0;i<26;i++)        {            sum=sum+num[i];        }        printf("Case #%ld: %ld\n",n,sum);        n++;    }    return 0;}
0 0
原创粉丝点击