結果

問題 No.3296 81-like number
ユーザー ripity
提出日時 2025-10-05 13:38:14
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 4,712 ms
コンパイル使用メモリ 334,840 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-05 13:40:02
合計ジャッジ時間 4,941 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

using ll = long long;
using mint = modint998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N;
    cin >> N;
    ll ans = 0;
    const int L = 1 << 17;
    vector<bool> pr(L);
    for(ll p = 2; p * p <= N; p++) {
        if(pr[p]) continue;
        for(ll k = 1; k * p < L; k++) {
            pr[k * p] = true;
        }
        ll x = p;
        while(x <= N / p) {
            x *= p;
            ans += x;
        }
    }
    cout << ans << endl;
}
0