結果

問題 No.1058 素敵な数
ユーザー definedefine
提出日時 2020-05-22 21:29:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 845 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 204,700 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-07-28 06:26:56
合計ジャッジ時間 6,197 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

bool prime(int x){
	for(int i=2;i*i<=x;i++)if(x%i==0)return false;
	return x!=1;
}
int ans[10];
void f(int x){
	vector<int>st;
	st.pb(1);
	for(int i=100001;i<=103000;i++){
		if(!prime(i))continue;
		for(int j=i;j<=i+3000;j++){
			if(!prime(j))continue;
			st.pb(i*j);
		}
	}
	sort(all(st));
	cout<<st[x-1]<<endl;
}
signed main(){
	int N;
	cin>>N;
	f(N);
}
0