結果
| 問題 |
No.1058 素敵な数
|
| コンテスト | |
| ユーザー |
Shibuyap
|
| 提出日時 | 2020-05-22 21:32:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,327 bytes |
| コンパイル時間 | 2,880 ms |
| コンパイル使用メモリ | 198,264 KB |
| 最終ジャッジ日時 | 2025-01-10 14:22:41 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 9 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
/*
Max_Prime以下の素数をprimes[]に格納
*/
const int Max_Prime = 1000000;
int tmp_primes[Max_Prime];
vector<int> primes;
void PrimeInit() {
rep(i,Max_Prime)tmp_primes[i] = 1;
tmp_primes[0] = 0;
tmp_primes[1] = 0;
rep(i,Max_Prime){
if(tmp_primes[i] == 0)continue;
int j = 2;
while(i * j <= Max_Prime){
tmp_primes[i*j] = 0;
j++;
}
}
rep(i,Max_Prime){
if(tmp_primes[i])primes.push_back(i);
}
}
int main(){
PrimeInit();
vector<ll> v;
rep(i,primes.size()){
if(primes[i] > 100000){
v.push_back(primes[i]);
}
}
ll ans[100];
rep(i,100)ans[i] = 1001001001001001001;
rep(i,10){
srep(j,i,10){
ans[i*10+j] = v[i] * v[j];
}
}
sort(ans,ans+100);
int n;
cin >> n;
if(n == 1){
cout << 1 << endl;
}else{
n--;
cout << ans[n] << endl;
}
return 0;
}
Shibuyap