結果

問題 No.1058 素敵な数
ユーザー auauaauaua
提出日時 2020-05-22 21:34:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,062 bytes
コンパイル時間 1,747 ms
コンパイル使用メモリ 171,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 16:09:58
合計ジャッジ時間 2,303 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
5,248 KB
testcase_01 AC 8 ms
5,376 KB
testcase_02 AC 8 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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,d.size())ans.pb(d[i]*d[j]);
    }
    ans.pb(1);
    sort(all(ans));
    cout<<ans[n-1]<<endl;
}
0