# TopCoder

\begin{align} AC \times 2^9 \\ \text{New TIOJ ?} \end{align}

62.5% (5/8)

35.7% (5/14)

# Description

#### Original Description

$880301$ 是個質數喔。

#### Original Input Format

• $1 \le N \le 100$
• $1 \le a_i \le 1000$

#### Original Sample Input

Sample Input 1:
3
9 15 143

Sample Input 2:
3
4 8 16


#### Original Sample Output

Sample Output 1:
32

Sample Output 2:
10


#### Original Limits

• Time Limit: 1 second
• Memory Limit: 256 MB

#### Program To Be Hacked

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

map<ll,ll> mp; //prime number --> the occurence of this prime

ll a[106];

void f1(int num,int cnt) {
for (int i=2;i<=num;++i) {
while (num % i == 0) {
mp[i] += cnt;
num /= i;
}
}
}

bool is_p[1006];

int main () {
for (int i=2;i<1006;++i) {
if (!is_p[i]) {
for (int j=i+i;j<1006;j+=i) is_p[j] = true;
}
}
//is_p[i] == false means i is a prime
int n;
cin >> n;
for (int i=0;i<n;++i) {
cin >> a[i];
}
for (int times=0;times<100;++times) {
for (int i=0;i<n;++i) {
for (int j=i+1;j<n;++j) {
ll gcd = __gcd(a[i],a[j]);
if (gcd != 1) {
int cnt=0;
for (int k=0;k<n;++k) {
if (a[k]%gcd == 0) {
cnt++;
a[k] /= gcd;
}
}
f1(gcd,cnt);
}
}
}
}
//after the process above, numbers left must be one of the following forms: p, p^2, p^3, p^4, p*q, and every prime factor in a[i] are distinct!!!
for (int i=0;i<n;++i) {
if (a[i] != 1) {
for (int x=2;x<=40;++x) {
if (x*x*x*x == a[i]) {
a[i] = 1;
mp[x] += 4;
break;
}
if (x*x*x == a[i]) {
a[i] = 1;
mp[x] += 3;
break;
}
if (x*x == a[i]) {
a[i] = 1;
mp[x] += 2;
break;
}
}
if (a[i] != 1) {
if (!is_p[ a[i] ]) mp[ a[i] ]+=1;
else {
//since I do not know what exactly p & q is, so I assume that one is a[i], the other is -a[i]
mp[ a[i] ]  = 1;
mp[ -a[i] ] = 1;
}
}
}
}
ll ans=1;
for (auto i:mp) {
ans *= (i.second+1);
ans %= 880301;
}
cout << ans << endl;
}


#### Sample Code

#include <cstdio>
int main() {
printf("3\n4 8 16\n");
}