建议看看数论相关
约数个数=(各质数底数的次数+1)的乘积
#include<iostream>
#include<unordered_map>
using namespace std;
const int mod = 1e9 + 7;
typedef long long LL;
int main() {
int n;
cin >> n;
unordered_map<int, int>ha;//记录质底数的次数
while (n--) {
int x;
cin >> x;
for (int i = 2; i <= x / i; i++) {
if (x % i == 0) {
while (x % i == 0) {
x /= i;
ha[i]++;
}
}
}
if (x > 1)ha[x]++;
}
LL res = 1;
for (auto item : ha)res = res * (item.second + 1) % mod;
cout << res << endl;
}