結果
| 問題 |
No.1058 素敵な数
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2020-05-22 21:39:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 2,000 ms |
| コード長 | 1,105 bytes |
| コンパイル時間 | 2,641 ms |
| コンパイル使用メモリ | 209,648 KB |
| 最終ジャッジ日時 | 2025-01-10 14:31:26 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';
template<typename V>
V compress(V vs){
sort(vs.begin(),vs.end());
vs.erase(unique(vs.begin(),vs.end()),vs.end());
return vs;
}
template<typename T>
map<T, Int> dict(const vector<T> &vs){
map<T, Int> res;
for(Int i=0;i<(Int)vs.size();i++)
res[vs[i]]=i;
return res;
}
map<char, Int> dict(const string &s){
return dict(vector<char>(s.begin(),s.end()));
}
//INSERT ABOVE HERE
const Int MAX = 1e5+1000;
Int fs[MAX]={};
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
vector<Int> ans;
for(Int i=2;i<MAX;i++){
if(fs[i]) continue;
if(i>=1e5) ans.emplace_back(i);
for(Int j=i;j<MAX;j+=i)
if(!fs[j]) fs[j]=i;
}
vector<Int> cand;
for(Int x:ans)
for(Int y:ans)
cand.emplace_back(x*y);
cand.emplace_back(1);
cand=compress(cand);
Int n;
cin>>n;
n--;
cout<<cand[n]<<newl;
return 0;
}
beet