結果

問題 No.1058 素敵な数
ユーザー seven_threeseven_three
提出日時 2020-05-22 21:33:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 787 bytes
コンパイル時間 929 ms
コンパイル使用メモリ 99,560 KB
実行使用メモリ 13,752 KB
最終ジャッジ日時 2024-04-15 16:04:03
合計ジャッジ時間 2,488 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long a[1000] = { 0 };
int main() {
	int co = 0;
	int n;
	cin >> n;
	for (long long i = 100001; i < 110000; i++) {
		bool b = true;
		for (long long j = 2; j * j < i; j++) {
			if (i % j == 0) {
				b = false;
			}
		}
		if (b == true) {
			a[co] = i;
			co++;
		}
	}
	vector<long long> vec;
	for (int i = 0; i < 863; i++) {
		for (int j = 0; j < 863; j++) {
			vec.emplace_back(a[i] * a[j]);
		}
	}
	vec.emplace_back(1);
	sort(vec.begin(), vec.end());
	cout << vec[n - 1] << endl;
	return 0;
}
0