結果
| 問題 | No.1058 素敵な数 |
| コンテスト | |
| ユーザー |
onsen_manjuuu
|
| 提出日時 | 2020-06-16 15:18:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 848 bytes |
| コンパイル時間 | 1,628 ms |
| コンパイル使用メモリ | 173,156 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 05:50:36 |
| 合計ジャッジ時間 | 2,205 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
vector<ll> divisor(ll n){
vector<ll> res;
for(ll i = 1LL; i * i <= n; i++){
if(n % i == 0){
res.push_back(i);
ll j = n / i;
if(i != j)res.push_back(j);
}
}
sort(res.begin(),res.end());
return res;
}
int main()
{
vector<ll> prime;
for(int i = 100001; prime.size() <= 100; i++) {
if(divisor(i).size() == 2)prime.push_back(i);
}
vector<ll> a;
int m = prime.size();
for(int i = 0; i < m; i++) {
for(int j = 0; j < m; j++) {
a.emplace_back(prime[i] * prime[j]);
}
}
sort(a.begin(), a.end());
unique(a.begin(), a.end());
int n; cin >> n;
if(n == 1) {
cout << 1 << endl;
} else {
cout << a[n - 2] << endl;
}
}
onsen_manjuuu