結果
問題 |
No.3159 Just Answer 10 Integers!
|
ユーザー |
![]() |
提出日時 | 2025-07-10 10:08:58 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,993 bytes |
コンパイル時間 | 6,370 ms |
コンパイル使用メモリ | 147,292 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-07-10 10:09:07 |
合計ジャッジ時間 | 3,930 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include <iostream> #include <iomanip> #include <vector> #include <queue> #include <deque> #include <set> #include <map> #include <algorithm> #include <cmath> #include <iterator> using namespace std; using i64 = int64_t; // using u64 = uint64_t; template<class T> using VV = vector<vector<T>>; #define REP(i, n) for(i64 i = 0; i < i64(n); i++) #define REP1(i, n) for(i64 i = 1; i <= i64(n); i++) i64 INF = 100100100100100L; i64 direct[8][2] = { {1, 0}, {0, -1}, {-1, 0}, {0, 1}, {1, -1}, {-1, -1}, {-1, 1}, {1, 1} }; template<class T, class S> ostream &operator<<(ostream &os, pair<T, S> p); template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { for(i64 i = 0; i < i64(v.size()); i++) { if (i > 0) os << ' '; os << v[i]; } return os; } template<class T> ostream &operator<<(ostream &os, const set<T> &st) { bool first = true; for(const T &it: st) if (first) { first = false; os << it; } else{ os << ' ' << it; } return os; } template<class T, class S> ostream &operator<<(ostream &os, map<T, S> &mp) { bool first = true; for(const auto &[f, l]: mp) if (first) { first = false; os << '{' << f << "-> " << l << '}'; } else{ os << ", {" << f << "-> " << l << '}'; } return os; } template<class T, class S> ostream &operator<<(ostream &os, pair<T, S> p) { os << '{' << p.first << ", " << p.second << '}'; return os; } vector<i64> primes; void get_primes(i64 n) { vector<bool> v(n + 1, true); v[0] = v[1] = false; for(i64 i = 2; i <= n; i++) { if (v[i]) { for(i64 j = i + i; j <= n; j += i) v[j] = false; } } for(i64 i = 2; i <= n; i++) if (v[i]) primes.push_back(i); } int main() { i64 N; cin >> N; get_primes(1000); vector<i64> ans; for(i64 i = 0; i < N; i++) { i64 prod = 1; for(i64 j = 0; j < N - 1; j++) if (i != j) prod *= primes[j]; ans.push_back(prod); } cout << ans << endl; return 0; }