結果

問題 No.3364 Push_back Operation
コンテスト
ユーザー fken_prime_57
提出日時 2025-10-29 15:52:25
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 5,181 ms
コンパイル使用メモリ 335,004 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-17 20:35:21
合計ジャッジ時間 8,926 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 53
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ll N;
    cin >> N;
    mint ans=0;
    ll uplimit=-1;
    for(ll i=1;i*i<=N;i++){
        ll up=N/i;
        ll down=N/(i+1);
        mint a=mint(i).pow(down+1);
        mint b=mint(i).pow(up-down);
        if(i==1) ans+=up-down;
        else{
            ans+=a*((b-1)/(i-1));
        }
        uplimit=N/(i+1);
    }
    for(ll i=1;i<=uplimit;i++){
        ans+=mint(N/i).pow(i);
    }
    cout << ans.val() << '\n';
}
0