cf1033D

 

每一个数都是 p*q p^2 p^3 p^4 的形式,分类讨论即可

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include<bits/stdc++.h>
#define forn(i, n) for (int i = 0 ; i < int(n) ; i++)
#define fore(i, s, t) for (int i = s ; i < (int)t ; i++)
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pf2(x,y) printf("%d %d\n",x,y)
#define pf(x) printf("%d\n",x)
#define each(x) for(auto it:x)  cout<<it<<endl;
#define pii pair<int,int>
#define sc(x) scanf("%d",&x)
using namespace std;
typedef long long ll;
const int maxn=2e5+5;
const int maxm=2e5+5;
const int inf=1e9;
const ll mod=998244353;
ll a[maxn],n;
 
 
long long my_sqrt(long long x) {
    long long l=1,r=2e9;
    while(l<r){
        long long mid=(l+r+1)>>1;
        if(mid*mid<=x) l=mid;
        else r=mid-1;
    }
    return l;
}
long long my_crt(long long x) {
    assert(x > 0);
    long long y = (long long) (powl((long double) x, 1.0 / 3.0) + 0.5);
    while (y * y * y<x) y++;
    while (y * y * y>x) y--;
    if (y * y * y == x) {
        return y;
    }
    return -1;
}
int main() {
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    map<ll,vector<pair<ll,ll>>> ls;
    ll ans=1;
    map<ll,ll> eq;
    for(int i=0;i<n;i++){
        ll t=my_sqrt(a[i]);
        if(t*t==a[i]) {
            ll k=my_sqrt(t);
            if(k*k*k*k==a[i]) ls[i].push_back({k,4});
            else ls[i].push_back({t,2});
        }
        else {
            t=my_crt(a[i]);
            if(t*t*t==a[i]) {
                ls[i].push_back({t,3});
            }
            else {
                bool flag=0;
                for(int j=0;j<n;j++){
                    if(j==i || a[i] == a[j])  continue;
                    ll g=__gcd(a[i],a[j]);
                    if(g!=1) {
                        ls[i].push_back({g,1});
                        ls[i].push_back({a[i]/g,1});
                        flag=1;break;
                    }
                }
                if(!flag) {
                    eq[a[i]]++;
                }
            }
             
        }
    }
    for(auto i:eq)
        if(i.se==1) ans=ans*4%mod;
        else ans=ans*(i.se+1)%mod*(i.se+1)%mod;
    map<ll,ll> ct;
    for(auto i:ls)
        for(auto j:i.se)
            ct[j.fi]+=j.se;
    for(auto i:ct)
        ans=ans*(i.se+1)%mod;
    cout<<ans<<endl;
}

  

posted on   欣崽  阅读(258)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示