結果
| 問題 | No.1058 素敵な数 |
| コンテスト | |
| ユーザー |
KoD
|
| 提出日時 | 2020-05-22 21:42:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,680 bytes |
| コンパイル時間 | 1,051 ms |
| コンパイル使用メモリ | 78,916 KB |
| 最終ジャッジ日時 | 2025-01-10 14:34:17 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
if (lhs > rhs) {
lhs = rhs;
return true;
}
return false;
}
template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
if (lhs < rhs) {
lhs = rhs;
return true;
}
return false;
}
// [l, r) from l to r
struct range {
struct itr {
int i;
constexpr itr(int i_): i(i_) { }
constexpr void operator ++ () { ++i; }
constexpr int operator * () const { return i; }
constexpr bool operator != (itr x) const { return i != x.i; }
};
const itr l, r;
constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
constexpr itr begin() const { return l; }
constexpr itr end() const { return r; }
};
// [l, r) from r to l
struct revrange {
struct itr {
int i;
constexpr itr(int i_): i(i_) { }
constexpr void operator ++ () { --i; }
constexpr int operator * () const { return i; }
constexpr bool operator != (itr x) const { return i != x.i; }
};
const itr l, r;
constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
constexpr itr begin() const { return r; }
constexpr itr end() const { return l; }
};
constexpr int64_t pr[10] = { 100003, 100019, 100043, 100049, 100057, 100069, 100103, 100109, 100129, 100151 };
int main() {
std::vector<int64_t> vec;
vec.push_back(1);
for (int i = 0; i < 10; ++i) {
for (int j = 0; j <= i; ++j) {
vec.push_back(pr[i] * pr[j]);
}
}
std::sort(vec.begin(), vec.end());
int N;
std::cin >> N;
std::cout << vec[N - 1] << '\n';
return 0;
}
KoD