Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
- #define pb emplace_back
- const int MAXX = 1e4 + 5;
- const int N = 1e4;
- const int NUM = 4000000;
- int t , n , i , j , k , s , m , cnt;
- bool p[MAXX];
- int ans[MAXX];
- vector<int> v;
- void sieve(){
- p[2] = true;
- for(i = 3; i < N; i += 2){
- p[i] = true;
- }
- for(i = 3; (i * i) < N; i += 2){
- if(p[i]){
- for(j = (i + i + i); j < N; j += (i + i))
- p[j] = false;
- }
- }
- v.pb(2);
- for(i = 3; i < N; i += 2){
- if(p[i])
- v.pb(i);
- }
- }
- signed main()
- {
- _FastIO;
- sieve();
- for(i = 1; i <= NUM; i++){
- k = i;
- s = 1;
- for(j = 0; (v[j] * v[j]) <= k; j++){
- if(k % v[j])
- continue;
- cnt = 0;
- while(k % v[j] == 0){
- k /= v[j];
- cnt++;
- }
- s *= (cnt + 1);
- }
- if(k > 1)
- s *= 2;
- while(m < s){
- m++;
- ans[m] = i;
- }
- }
- scanf("%d" , &t);
- while(t--){
- scanf("%d" , &n);
- printf("%d" , ans[n]);
- putchar('\n');
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement