結果

問題 No.1058 素敵な数
ユーザー TAISA_TAISA_
提出日時 2020-05-22 21:30:57
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,878 bytes
コンパイル時間 3,075 ms
コンパイル使用メモリ 201,120 KB
実行使用メモリ 12,268 KB
最終ジャッジ日時 2024-04-15 15:56:46
合計ジャッジ時間 3,181 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
12,260 KB
testcase_01 AC 22 ms
12,268 KB
testcase_02 AC 22 ms
12,136 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
template <class T>
inline void chmin(T &a, const T &b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); }
inline int popcount(const int &n) { return __builtin_popcount(n); }
inline ll popcountll(const ll &n) { return __builtin_popcountll(n); }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
void dump() {
    cerr << '\n';
}
template <class Head, class... Tail>
void dump(Head &&head, Tail &&... tail) {
    cerr << head << (sizeof...(Tail) == 0 ? " " : ", ");
    dump(std::move(tail)...);
}
template <class T>
void print(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void read(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
constexpr char sp = ' ', newl = '\n';
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int ma = 1000000, m = 100000;
    V<ll> p(ma), v;
    for (int i = 2; i < ma; i++) {
        if (p[i]) continue;
        for (int j = i + i; j < ma; j += i) {
            p[j] = 1;
        }
        if (i > m) {
            v.eb(i);
        }
    }
    V<ll> res;
    res.eb(1);
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            res.eb(v[i] * v[j]);
        }
    }
    sort(all(res));
    cout << res[n - 1] << newl;
}
0