結果
| 問題 | 
                            No.1058 素敵な数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nsy_fuya
                         | 
                    
| 提出日時 | 2020-05-28 02:25:47 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 8 ms / 2,000 ms | 
| コード長 | 853 bytes | 
| コンパイル時間 | 1,657 ms | 
| コンパイル使用メモリ | 174,788 KB | 
| 実行使用メモリ | 5,532 KB | 
| 最終ジャッジ日時 | 2024-10-13 04:00:23 | 
| 合計ジャッジ時間 | 2,237 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 9 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
bool prime[1000005];
vector<llint> pvec, vec;
void solve(){
    int n;
    cin >> n;
    for(int i = 2; i < 100005; i++){
		if(prime[i]) continue;
		for(int j = 2*i; j < 1000005; j+=i) prime[j] = true;
	}
    for(int i = 100001; i < 1000000; i++){
		if(!prime[i]) pvec.push_back(i);
	}
	vec.push_back(1);
	
	for(int i = 0; i < 20; i++){
		for(int j = 0; j < 20; j++){
			if(i > j) continue;
			vec.push_back(pvec[i]*pvec[j]);
		}
	}
	sort(vec.begin(), vec.end());
    cout << vec[n-1] << endl;
   
}
int main(){
  solve();
  return 0;
}
            
            
            
        
            
nsy_fuya