From bce5bef444ca1ecc16640f10f466b0bc3b93b249 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 12 Sep 2022 21:36:22 +0800 Subject: [PATCH] =?UTF-8?q?1986=20-=20=E6=9E=84=E9=80=A0=E9=9B=86=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 77474 --- bjtu/1986/1986.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 bjtu/1986/1986.cpp diff --git a/bjtu/1986/1986.cpp b/bjtu/1986/1986.cpp new file mode 100644 index 00000000..2feaa5d3 --- /dev/null +++ b/bjtu/1986/1986.cpp @@ -0,0 +1,60 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e5 + 5; + +const int primes[] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 47, 51, 53}; +const int ci[] = {0, 6, 3, 2, 1, 1, 1, 1, 1, 1, 1}; + +int n, cnt; +long long a[N]; +long long k = 9316358251200; + +long long binpow(long long a, long long b) { + long long res = 1; + + while (b) { + if (b & 1) res *= a; + a *= a; + b >>= 1; + } + + return res; +} + +void dfs(int step, long long now) { + if (step == 10) { + a[++cnt] = now; + return; + } + + for (int i = 0; i <= ci[step + 1]; i++) { + dfs(step + 1, now * binpow(primes[step + 1], i)); + } +} + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n; + + dfs(0, 1); + + for (int i = 1; i <= n; i++) { + cout << k * i + 1 << ' '; + } + + cout << endl; + + for (int i = 2; i <= n + 1; i++) { + cout << a[i] << ' '; + } + + cout << endl; + + return 0; +}