結果
| 問題 |
No.1058 素敵な数
|
| コンテスト | |
| ユーザー |
scol_kp
|
| 提出日時 | 2020-05-22 21:39:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,428 bytes |
| コンパイル時間 | 3,847 ms |
| コンパイル使用メモリ | 198,384 KB |
| 最終ジャッジ日時 | 2025-01-10 14:32:07 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 7 |
ソースコード
#include <bits/stdc++.h>
#define FASTIO
using namespace std;
using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void solve() {
ll N;
cin >> N;
Vl ps;
for (ll x = 100001;; x++) {
bool ok = true;
for (ll y = 2; y * y <= x; y++) {
if (x % y == 0) {
ok = false;
break;
}
}
if (ok) {
ps.emplace_back(x);
}
if (ps.size() == 10) {
break;
}
}
Vl vs;
for (ll i = 0; i < 10; i++) {
for (ll j = 0; j < 10; j++) {
vs.emplace_back(ps[i] * ps[j]);
}
}
sort(vs.begin(), vs.end());
if (N == 1) {
cout << 1 << endl;
}
else {
cout << vs[N - 2] << endl;
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
int main() {
#ifdef FASTIO
cin.tie(0), cout.tie(0);
ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
ifstream ifs("./in_out/input.txt");
cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
ofstream ofs("./in_out/output.txt");
cout.rdbuf(ofs.rdbuf());
#endif
solve();
cout << flush;
return 0;
}
scol_kp