結果
問題 | No.1058 素敵な数 |
ユーザー | mmn15277198 |
提出日時 | 2020-06-29 10:37:11 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 834 bytes |
コンパイル時間 | 1,193 ms |
コンパイル使用メモリ | 103,076 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-25 09:47:07 |
合計ジャッジ時間 | 2,192 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,380 KB |
ソースコード
#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; }