結果

問題 No.3573 σ(N),d(N)
コンテスト
ユーザー t98slider
提出日時 2026-06-20 20:17:09
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 896 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,308 ms
コンパイル使用メモリ 375,484 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-20 20:17:20
合計ジャッジ時間 9,642 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> primes = {2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607};
    int sz = primes.size();
    vector<mint> pow2(sz);
    for(int i = 0; i < sz; i++) pow2[i] = mint::raw(2).pow(primes[i]) - mint::raw(1);
    mint ans;
    for(int S = 0; S < (1 << sz); S++) {
        int sv = 0, U = S;
        while(U > 0){
            sv += primes[__lg(U & -U)];
            U -= U & -U;
        }
        if (sv == __builtin_popcount(S) * n) {
            mint tmp = 1;
            U = S;
            while(U > 0){
                tmp *= pow2[__lg(U & -U)];
                U -= U & -U;
            }
            ans += tmp;
        }
    }
    cout << ans.val() << '\n';
}
0