結果
問題 |
No.1058 素敵な数
|
ユーザー |
![]() |
提出日時 | 2020-06-29 10:37:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 834 bytes |
コンパイル時間 | 950 ms |
コンパイル使用メモリ | 104,928 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 07:58:10 |
合計ジャッジ時間 | 1,407 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#pragma GCC optimize("Ofast") #include<iostream> #include<stdio.h> #include<algorithm> #include<vector> #include<string.h> #include<math.h> #include<map> #include<iomanip> #include<queue> const long long INF = 1e17+7; const long long MOD = 1e9+7; const double PI=acos(-1); using namespace std; bool is_prime(long long x){ bool res=true; for(long long i=2;i*i<=x;i++){ if(x%i==0){ res=false; return res; } } return res; } int main(){ int n; cin >> n; long long start=100001; vector<long long> v; //v.push_back(1); while(1){ if(v.size()==n)break; if(is_prime(start)){ v.push_back(start); } start++; } vector<long long> ans; for(int i=0;i<v.size();i++){ for(int j=i;j<v.size();j++){ ans.push_back(v[i]*v[j]); } } ans.push_back(1); sort(ans.begin(),ans.end()); cout << ans[n-1] << endl; }