結果
| 問題 | 
                            No.1058 素敵な数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             seven_three
                         | 
                    
| 提出日時 | 2020-05-22 21:39:21 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 35 ms / 2,000 ms | 
| コード長 | 926 bytes | 
| コンパイル時間 | 771 ms | 
| コンパイル使用メモリ | 99,376 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-05 16:12:25 | 
| 合計ジャッジ時間 | 1,583 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 9 | 
ソースコード
#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 < 50; i++) {
		for (int j = 0; j < 50; j++) {
			bool bo = true;
			for(int k=0;k<vec.size();k++){
				if (vec[k] == a[i] * a[j]) {
					bo = false;
				}
			}
			if (bo == true) {
				vec.emplace_back(a[i] * a[j]);
			}
		}
	}
	vec.emplace_back(1);
	sort(vec.begin(), vec.end());
	cout << vec[n - 1] << endl;
	return 0;
}
            
            
            
        
            
seven_three