結果

問題 No.1058 素敵な数
ユーザー evawenisevawenis
提出日時 2020-07-07 13:30:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 552 bytes
コンパイル時間 2,214 ms
コンパイル使用メモリ 206,976 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-24 10:38:06
合計ジャッジ時間 3,123 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	vector<bool>v(1e6+1,true);
	for(int i=2;i*i<=1e6;++i){
		if(!v.at(i))continue;
		for(int j=i*i;j<=1e6;j+=i){
			v.at(j)=false;
		}
	}
	vector<int64_t>p;
	int i=1e5+1;
	while(p.size()<7){
		if(v.at(i))p.emplace_back(i);
		++i;
	}
	vector<int64_t>ans;
	for(i=0;i<p.size();++i){
		for(int j=i;j<p.size();++j){
			ans.emplace_back(p.at(i)*p.at(j));
		}
	}
	ans.emplace_back(1);
	sort(ans.begin(),ans.end());
	int n; cin>>n; --n;
	cout<<ans.at(n)<<"\n"s;
}
0