結果

問題 No.1058 素敵な数
ユーザー heno239heno239
提出日時 2020-05-23 01:32:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,242 bytes
コンパイル時間 1,064 ms
コンパイル使用メモリ 111,532 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-04-15 22:26:34
合計ジャッジ時間 7,426 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<cassert>
#include<random>
#include<unordered_map>
#include<numeric>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define stop char nyaa;cin>>nyaa;


using P = pair<int, int>;
using ll = long long;
using LP = pair<ll, ll>;

const ll inf = 1000000007;
const ll INF = inf * inf;






bool isp(ll x) {
	ll k = sqrt(x + 0.1);
	for (int j = 2; j <= k + 1; j++) {
		if (j != x) {
			if (x%j == 0)return false;
		}
	}
	return true;
}


void solve() {
	int n;
	cin >> n;

	vector<ll> anss;
	anss.push_back(1);
	ll cur = 10000000000;
	while (anss.size() < 10) {
		bool valid = true;
		if (isp(cur))valid = false;
		for (int i = 2; i <= 100000; i++) {
			if (cur%i == 0)valid = false;
		}
		if (valid)anss.push_back(cur);
		cur++;
	}
	cout << anss[n - 1] << "\n";
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int t; cin >> t;rep(i, t)solve();
	solve();
	stop
	return 0;
}
0