結果

問題 No.2750 Number of Prime Factors
ユーザー tobbietobbie
提出日時 2024-06-08 21:08:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 1,709 ms
コンパイル使用メモリ 171,800 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-08 21:08:34
合計ジャッジ時間 2,995 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 2 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 2 ms
5,376 KB
testcase_15 WA -
testcase_16 AC 1 ms
5,376 KB
testcase_17 WA -
testcase_18 AC 2 ms
5,376 KB
testcase_19 WA -
testcase_20 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long int;

vector<int> eratosthenes(int n) {
  vector<bool> prime(n+1, true);
  vector<int> p;
  prime[0] = false;
  prime[1] = false;
  for (int i = 2; i <= n; i++) {
    if (!prime[i])
      continue;
    p.push_back(i);
    for (int j = i*2; j <= n; j += i)
      prime[j] = false;
  }
  return p;
}

int main() {
  ll N;
  cin >> N;
  vector<int> p = eratosthenes(60);
  ll po = 1;
  int n = 0;
  while (po * p[n] < N && n < 15) {
    po *= p[n];
    n++;
  }
  cout << n << endl;
  return 0;
}
0