結果

問題 No.1058 素敵な数
ユーザー SSRSSSRS
提出日時 2020-05-22 21:30:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 1,844 ms
コンパイル使用メモリ 173,712 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-28 06:28:30
合計ジャッジ時間 2,387 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 4 ms
4,376 KB
testcase_02 AC 4 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 3 ms
4,384 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<bool> b(110000, true);
  for (int i = 2; i <= 100000; i++){
    for (int j = i; j < 110000; j += i){
      b[j] = false;
    }
  }
  vector<long long> p;
  for (int i = 100000; i < 110000; i++){
    if (b[i]){
      p.push_back(i);
      if (p.size() >= 10){
        break;
      }
    }
  }
  set<long long> A;
  A.insert(1);
  for (long long i : p){
    for (long long j : p){
      A.insert(i * j);
    }
  }
  vector<long long> B;
  for (long long i : A){
    B.push_back(i);
  }
  int N;
  cin >> N;
  cout << B[N - 1] << endl;
}
0