結果
問題 | No.1058 素敵な数 |
ユーザー |
![]() |
提出日時 | 2020-05-22 21:37:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 1,064 bytes |
コンパイル時間 | 1,576 ms |
コンパイル使用メモリ | 174,828 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-05 16:06:40 |
合計ジャッジ時間 | 2,170 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include<bits/stdc++.h>#include<unordered_set>#include<unordered_map>using namespace std;#define int long long#define REP(i,m,n) for(int i=(m);i<(n);i++)#define rep(i,n) REP(i,0,n)#define pb push_back#define all(a) a.begin(),a.end()#define rall(c) (c).rbegin(),(c).rend()#define mp make_pair#define endl '\n'typedef long long ll;typedef pair<ll,ll> pll;typedef long double ld;const ll inf=1e9+7;const ll mod=1e9+7;//エラトステネスの篩vector<bool> IsPrime(1000010,true);void sieve(ll n){IsPrime[0]=0;IsPrime[1]=0;REP(i,2,n+1){if(IsPrime[i]){ll k=2;while(k*i<=n){IsPrime[k*i]=0;k++;}}}}signed main(){ll cnt=0;ll n;cin>>n;sieve(1000000);vector<ll>d(0);rep(i,1000000){if(d.size()==10)break;if(IsPrime[i]&&i>100000)d.pb(i);}vector<ll>ans(0);rep(i,d.size()){REP(j,i,d.size())ans.pb(d[i]*d[j]);}ans.pb(1);sort(all(ans));cout<<ans[n-1]<<endl;}