結果
問題 |
No.2750 Number of Prime Factors
|
ユーザー |
|
提出日時 | 2024-05-14 08:07:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 576 bytes |
コンパイル時間 | 1,798 ms |
コンパイル使用メモリ | 193,616 KB |
最終ジャッジ日時 | 2025-02-21 13:59:30 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; template<typename T> T MUL(T a, T b){ T res; return __builtin_mul_overflow(a, b, &res)? std::numeric_limits<T>::max() : res; } int main(){ ios::sync_with_stdio(false); cin.tie(0); vector<bool> tb(101); ll n, v = 1; int ans = 0; cin >> n; for(int i = 2; i <= 100 && v <= n; i++){ if(tb[i]) continue; v = MUL(v, (ll)i); if(v <= n) ans++; for(int j = i; j <= 100; j += i){ tb[j] = true; } } cout << ans << '\n'; }