結果

問題 No.1058 素敵な数
ユーザー zelnyokzelnyok
提出日時 2020-05-22 21:29:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 1,010 bytes
コンパイル時間 1,398 ms
コンパイル使用メモリ 126,176 KB
実行使用メモリ 7,252 KB
最終ジャッジ日時 2024-04-15 15:53:12
合計ジャッジ時間 2,568 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
7,096 KB
testcase_01 AC 36 ms
7,168 KB
testcase_02 AC 36 ms
7,252 KB
testcase_03 AC 37 ms
7,248 KB
testcase_04 AC 38 ms
7,084 KB
testcase_05 AC 37 ms
7,192 KB
testcase_06 AC 36 ms
7,196 KB
testcase_07 AC 36 ms
7,104 KB
testcase_08 AC 38 ms
7,088 KB
testcase_09 AC 37 ms
7,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
constexpr lnt INF = 2e18;
/*-*/

int main() {
	int n;
	std::cin >> n;
	lnt x=1e6;
	std::vector<int> prime(x,true);
	for(int i=2;i<x;i++) for(int j=2;j*i<x;j++) prime[i*j]=false;
	std::vector<lnt> v;
	for(int i=1e5+1;i<x;i++) {
		if(prime[i]) v.emplace_back(i);
		if(v.size()>10) break;
	}
	std::set<lnt> set;
	for(lnt a:v) for(lnt b:v) set.emplace(a*b);
	std::vector<lnt> ans;
	for(lnt e:set) ans.emplace_back(e);
	if(n==1) print(1);
	else print(ans[n-2]);
}
0