Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const long long mod = (long long)(1e9 + 7);
- int minPrime[10000000+10];
- int a[1000000];
- void Sieve(int n)
- {
- for (int i = 2; i* i <= n; i++)
- {
- if (minPrime[i] == 0)
- {
- for (int j = i * i; j <= n; j+= i)
- {
- if (minPrime[j] == 0) minPrime[j] = i;
- }
- }
- }
- for (int i = 2; i <= n; i++)
- {
- if (minPrime[i] == 0) minPrime[i] = i;
- }
- }
- vector<pair<int, int>> PhanTich(int n)
- {
- vector<pair<int, int>> res;
- int current = 0;
- while (n > 1)
- {
- if (current != minPrime[n]) current = minPrime[n];
- int num = 0;
- while (current == minPrime[n])
- {
- num++;
- n /= minPrime[n];
- }
- res.push_back({current, num});
- }
- if (n > 1) res.push_back({n, 1});
- return res;
- }
- int task(int n)
- {
- vector<pair<int, int>> input = PhanTich(n);
- int res = 1;
- for (auto it:input)
- {
- res *= it.second + 1;
- }
- return res;
- }
- int main()
- {
- int n;
- cin >> n;
- for (int i = 0; i < n; i++)
- {
- cin >> a[i];
- }
- Sieve(10000000);
- int tich = 1;
- for (int i = 0; i < n; i++)
- {
- int temp = task(a[i]);
- tich = ((tich % mod) * (temp % mod)) % mod;
- }
- cout << tich << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement