結果
問題 |
No.3296 81-like number
|
ユーザー |
|
提出日時 | 2025-10-05 13:36:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 523 bytes |
コンパイル時間 | 1,326 ms |
コンパイル使用メモリ | 195,508 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-10-05 13:37:46 |
合計ジャッジ時間 | 2,077 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; constexpr int r = 100'000; vector<bool> tb(r + 1); unsigned long long ans = 0; for(int i = 2; i <= r; i++){ if(tb[i]) continue; ll v = (ll)i * i; if(v > n) break; while(v <= n){ ans += v; v *= i; } for(int j = 2 * i; j <= r; j += i) tb[j] = true; } cout << ans << '\n'; }