結果

問題 No.1058 素敵な数
ユーザー mmn15277198mmn15277198
提出日時 2020-06-29 09:37:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 660 bytes
コンパイル時間 2,311 ms
コンパイル使用メモリ 97,452 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 08:16:13
合計ジャッジ時間 1,801 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INF = 1e17+7;
const long long MOD = 1e9+7;
const double PI=acos(-1);

using namespace std;

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

int main(){
	int n;
	cin >> n;
	long long start=100001;
	vector<long long> v;
	v.push_back(1);
	while(1){
		if(v.size()==n)break;
		if(is_prime(start)){
			v.push_back(start);
		}
		start++;
	}
	cout << v[n-1] << endl;
}
0