結果
| 問題 |
No.1058 素敵な数
|
| コンテスト | |
| ユーザー |
onsen_manjuuu
|
| 提出日時 | 2020-06-16 15:17:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,467 bytes |
| コンパイル時間 | 1,535 ms |
| コンパイル使用メモリ | 172,976 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 05:50:40 |
| 合計ジャッジ時間 | 2,050 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 7 |
ソースコード
#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;
}
/***********debug tools***********/
template<class T> ostream& operator<<(ostream& os, const pair<T,T>& p){os << "{" << p.first << "," << p.second << "}";return os; }
template<class T> inline void print(pair<T,T> p){cerr << p << endl;}
template<class T> inline void print(vector<T> arr) {cerr << "["; for(int i = 0; i < (int)arr.size(); i++)cerr << arr[i] << (i == (int)arr.size() - 1 ? "]" : ",");cerr << endl;}
template<class T> inline void print(vector<vector<T>> arr) {cerr << "[-------------------" << endl; for(int i = 0; i < (int)arr.size(); i++) { print(arr[i]);} cerr << "-------------------]" << endl;}
/*********************************/
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());
int n; cin >> n;
if(n == 1) {
cout << 1 << endl;
} else {
cout << a[n - 2] << endl;
}
}
onsen_manjuuu