結果
| 問題 |
No.2750 Number of Prime Factors
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-05-17 07:52:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,157 bytes |
| コンパイル時間 | 2,016 ms |
| コンパイル使用メモリ | 196,828 KB |
| 最終ジャッジ日時 | 2025-02-21 14:22:13 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;
using LL = __int128_t;
istream &operator>>(istream &is, LL &x) {
int c = is.peek();
while (c == ' ' || c == '\n') {
is.get();
c = is.peek();
}
bool neg = false;
if (c == '-') {
neg = true;
is.get();
}
x = 0;
while (isdigit(is.peek())) {
x = x * 10 + is.get() - '0';
}
if (neg) {
x = -x;
}
return is;
}
ostream &operator<<(ostream &os, LL x) {
if (x < 0) {
os << '-';
x = -x;
}
if (x == 0) {
return os << '0';
}
string s;
while (x > 0) {
s += x % 10 + '0';
x /= 10;
}
reverse(s.begin(), s.end());
return os << s;
}
const vector<ll> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
int main() {
LL N;
cin >> N;
LL tmp = 1;
int ans = 0;
for (ll x : primes) {
if (tmp * x > N) {
cout << ans << endl;
break;
}
tmp *= x;
ans++;
}
}
Today03