結果

問題 No.1058 素敵な数
ユーザー sigmanisigmani
提出日時 2022-02-20 16:35:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,329 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 1,810 ms
コンパイル使用メモリ 175,152 KB
実行使用メモリ 6,052 KB
最終ジャッジ日時 2023-09-11 21:03:27
合計ジャッジ時間 17,016 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,327 ms
5,912 KB
testcase_01 AC 1,328 ms
5,784 KB
testcase_02 AC 1,327 ms
5,776 KB
testcase_03 AC 1,329 ms
5,892 KB
testcase_04 AC 1,329 ms
5,940 KB
testcase_05 AC 1,327 ms
5,836 KB
testcase_06 AC 1,327 ms
5,764 KB
testcase_07 AC 1,327 ms
6,052 KB
testcase_08 AC 1,329 ms
5,836 KB
testcase_09 AC 1,328 ms
5,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
bool isPrime(int x){
if(x==1)return 0;
if(x==2)return 1;
for(int i=2;i*i<=x;i++)if(x%i==0)return 0;
return 1;
}
int  main(){
  int N;
  cin>>N;
  map<long long, int> M;
  priority_queue<long long, vector<long long>, greater<long long >> Q;
  Q.push(1);
  for(long i=100001;i<=103220;i++){
    for(long long j=100001;j<=103220;j++){
      if(isPrime(i)&&isPrime(j)&&M[i*j]==0){
        Q.push(i*j);
        M[i*j]++;
      }
    }
  }
  for(int i=1;i<=N-1;i++){   
    Q.pop();
  }
  cout<<Q.top();




}
0