1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
#include <bits/stdc++.h> #define FIO cin.tie(0); ios::sync_with_stdio(false) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define TEST #define TESTS int t = 1; cin >> t; while (t--)
#if 0 #define int i64 #define inf 0x3f3f3f3f3f3f3f3fLL #else #define inf 0x3f3f3f3f #endif
template<typename T> void chkmin(T& a, T b) { a = std::min(a, b); } template<typename T> void chkmax(T& a, T b) { a = std::max(a, b); } template<typename T, const size_t S> std::ostream& operator<<(std::ostream& o, const std::array<T, S>& x) { for (int i = (o << "[", 0); i < S; ++i) o << x[i] << (i + 1 < x.size() ? ", " : ""); return o << "]";} template<typename T> std::ostream& operator<<(std::ostream& o, const std::vector<T>& x) { for (int i = (o << "[", 0); i < x.size(); ++i) o << x[i] << (i + 1 < x.size() ? ", " : ""); return o << "]";}
#ifndef ONLINE_JUDGE #define debug(...) std::cerr << #__VA_ARGS__ << " = ", dbg1(__VA_ARGS__) void dbg2() { std::cerr << "\n"; } template<typename T, typename... T2> void dbg2(T x, T2... args) { std::cerr << ", " << x; dbg2(args...); } template<typename T, typename... T2> void dbg1(T x, T2... args) { std::cerr << x; dbg2(args...); } template<typename T> void dbg1(std::vector<T> x, int s) { s = std::min<int>(s, x.size()); for (int i = (std::cerr << "[", 0); i < s; ++i) std::cerr << x[i] << (i + 1 < s ? ", " : "]\n"); } #else #define debug(...) #endif
using namespace std; using i64 = long long; using u32 = unsigned; using u64 = unsigned long long; using pii = std::pair<int, int>;
inline char nc() { static char buf[1 << 20], *p1, *p2; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin), p1 == p2) ? EOF : *p1++; } #ifndef ONLINE_JUDGE #define nc getchar #endif void read() {} template<typename T, typename... T2> inline void read(T &x, T2 &... oth) { x = 0; char c = nc(), up = c; while(!isdigit(c)) up = c, c = nc(); while(isdigit(c)) x = x * 10 + c - '0', c = nc(); up == '-' ? x = -x : 0; read(oth...); }
constexpr int N = 1e6 + 5; constexpr int MOD = 998244353;
int vis[N]; vector<int> ans;
void init() { vis[1] = 1; ans.reserve(N / 2 + 1); for (int i = 1; i < N; i++) { if (vis[i]) continue; ans.push_back(i); for (int y : ans) { if (1LL * i * y >= N) break; vis[i * y] = 1; } } }
void solve() { int n; cin >> n; int cnt = 0; for (auto x : ans | views::take(n / 2)) { cout << x << " "; } cout << "\n"; }
signed main() { FIO; init(); TESTS { solve(); }
return 0; }
|