Untitled

 avatar
unknown
plain_text
10 months ago
523 B
11
Indexable
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1e6 + 5;
int divisors[MAXN];

void computeDivisors() {
    for (int i = 1; i < MAXN; i++) {
        for (int j = i; j < MAXN; j += i) {
            divisors[j]++;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    computeDivisors();
    
    int q;
    cin >> q;
    
    while (q--) {
        int n;
        cin >> n;
        cout << divisors[n] << "\n";
    }
    
    return 0;
}
Editor is loading...
Leave a Comment