結果
| 問題 |
No.2750 Number of Prime Factors
|
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2024-05-10 21:33:31 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 921 bytes |
| コンパイル時間 | 5,321 ms |
| コンパイル使用メモリ | 310,792 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-20 04:29:43 |
| 合計ジャッジ時間 | 6,048 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
vector<i64> erathosthenes(i64 N) {
vector<i64> is_prime(N + 1, 1);
is_prime[0] = is_prime[1] = 0;
vector<i64> ret;
for (i64 i = 2; i <= N; i++) {
if (!is_prime[i]) continue;
ret.push_back(i);
for (i64 j = i; j <= N; j += i) {
is_prime[j] = 0;
}
}
return ret;
}
int main() {
FAST_IO
auto ans = 0LL;
__int128_t N;
i64 n;
cin >> n;
N = n;
auto primes = erathosthenes(10000);
__int128_t x = 1;
for (auto p : primes) {
if (x * p <= N) {
x *= p;
ans++;
} else {
break;
}
}
cout << ans << endl;
}
hiromi_ayase