結果
問題 | No.1058 素敵な数 |
ユーザー |
![]() |
提出日時 | 2020-05-22 21:30:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 549 bytes |
コンパイル時間 | 1,897 ms |
コンパイル使用メモリ | 173,264 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-05 15:24:21 |
合計ジャッジ時間 | 2,345 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 2 WA * 7 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0; i<(int)(n); i++)using namespace std;typedef long long LL;typedef pair<int,int> P;bool is_prime(LL p){for(LL i=2; i*i<=p; i++) if(p%i==0) return false;return true;}int main(){int N;cin >> N;vector<LL> p, ans;ans.emplace_back(1LL);LL num=1e5+1;while(1){if(is_prime(num)) p.emplace_back(num);num++;if(p.size()>=10) break;}rep(i,p.size()){rep(j,p.size()) ans.emplace_back(p[i]*p[j]);}sort(ans.begin(),ans.end());cout << ans[N-1] << endl;return 0;}