/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 18ms 4.371 MiB
#2 Accepted 18ms 4.371 MiB
#3 Accepted 43ms 4.141 MiB
#4 Accepted 39ms 4.367 MiB
#5 Accepted 56ms 5.77 MiB
#6 Accepted 26ms 4.375 MiB
#7 Accepted 29ms 4.621 MiB
#8 Accepted 27ms 4.375 MiB
#9 Accepted 32ms 4.566 MiB
#10 Accepted 52ms 4.375 MiB
#11 Accepted 56ms 4.312 MiB

Code

#define _GLIBCXX_FILESYSTEM
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e6+2,mod = 1e9+7;

int spf[N],cnt[N];
void solve() {
    for(int i = 2; i < N; i++)
        spf[i] = i;
    for(int i = 2; i < N; i++) {
        if(spf[i] == i) {
            for(int j = 2*i; j < N; j += i) {
                if(spf[j] == j) spf[j] = i;
            }
        }
    }
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        while(x > 1) {
            cnt[spf[x]]++;
            x /= spf[x];
        }
    }
    ll ans = 1;
    for(int i = 2; i < N; i++) {
        ans *= 1ll * (cnt[i]+1);
        ans %= mod;
    }
    cout << ans << '\n';
    return;
}

int32_t main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int tc = 1;
    // cin >> tc;
    for(int kase = 1; kase <= tc; kase++) {
        //cout << "Case " << kase << ": ";
        solve();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1060 Divisor
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 12:28:11
Judged At
2024-08-16 12:28:11
Judged By
Score
100
Total Time
56ms
Peak Memory
5.77 MiB