結果
| 問題 |
No.2750 Number of Prime Factors
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-10 23:05:35 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 184 ms / 2,000 ms |
| コード長 | 733 bytes |
| コンパイル時間 | 3,177 ms |
| コンパイル使用メモリ | 252,632 KB |
| 実行使用メモリ | 48,808 KB |
| 最終ジャッジ日時 | 2024-12-20 07:16:11 |
| 合計ジャッジ時間 | 7,648 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
// linear sieve
vector<bool> isp;
vector<int> ps, pf;
void sieve(int mx) {
isp.resize(mx+1);
pf.resize(mx+1);
rep(i, mx+1) pf[i] = i;
for (int i = 2; i <= mx; ++i) {
if (pf[i] == i) isp[i] = true, ps.push_back(i);
rep(j, ps.size()) {
int x = ps[j] * i;
if (x > mx) break;
pf[x] = ps[j];
}
}
}
int main() {
sieve(1e7);
ll n;
cin >> n;
__int128_t now = 1;
int ans = 0;
for (int p : ps) {
if (now*p > n) break;
now *= p;
ans++;
}
cout << ans << '\n';
return 0;
}