给定n个数,求这些数的乘积的约数的个数,答案mod 1e9+7
# 题解
累计每个数的质因子的指数,最后用指数来计算即可
1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 const int mod=1e9+7; 5 unordered_map<int,int >primes; 6 int main(){ 7 int n; 8 scanf("%d",&n); 9 10 while(n--){ 11 int x; 12 scanf("%d",&x); 13 for (int i = 2; i <=x/i ; ++i) 14 while(x%i==0){ 15 x/=i; 16 primes[i]++; 17 } 18 if(x>1) primes[x]++; 19 } 20 LL res=1; 21 for (auto prime:primes) 22 res=res*(prime.second+1)%mod; 23 cout<<res<<endl; 24 return 0; 25 }