結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 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>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

bool is_prime(LL p){
	for(LL i=2; i*i<=p; i++) if(p%i==0) return false;
	return true;
}

int main(){
	int N;
	cin >> N;
	vector<LL> p, ans;
	ans.emplace_back(1LL);
	LL num=1e5+1;
	while(1){
		if(is_prime(num)) p.emplace_back(num);
		num++;
		if(p.size()>=10) break;
	}
	rep(i,p.size()){
		rep(j,p.size()) ans.emplace_back(p[i]*p[j]);
	}
	sort(ans.begin(),ans.end());
	cout << ans[N-1] << endl;

	return 0;
}
0