Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Created by: Son Dinh
- */
- #include<bits/stdc++.h>
- using namespace std;
- #define fi first
- #define se second
- #define mp make_pair
- #define pb push_back
- #define sqr(x) (x)*(x)
- #define sz(X) (int)(X).size()
- #define all(x) x.begin(),x.end()
- typedef long long ll;
- typedef unsigned long long ull;
- typedef pair<int,int> pii;
- const int mod = 1e9+7;
- const int MAX = 2e6 + 5;
- int nprime[MAX],f[MAX];
- void sieve(){
- for(int i = 2; i * i < MAX; ++i){
- if(!nprime[i]){
- for(int j = i * i; j < MAX; j += i) nprime[j] = 1;
- }
- }
- for(int i = 2; i < MAX; ++i)
- if(nprime[i]){
- for(int j = i; j < MAX; j += i) ++f[j];
- }
- }
- int q,i;
- int main(){
- ios::sync_with_stdio(0);
- cin.tie(0);
- sieve();
- cin >> q;
- while(q--){
- cin >> i;
- cout << f[i] + 1 << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement