結果

問題 No.1184 Hà Nội
ユーザー akane
提出日時 2020-08-22 13:50:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 689 bytes
コンパイル時間 2,640 ms
コンパイル使用メモリ 191,452 KB
最終ジャッジ日時 2025-01-13 08:06:34
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i < (n); i++)
using namespace std;
using ll = long long;


ll mod = 998244353;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main(){
    ios::sync_with_stdio(false);
    ll N,L; cin>>N>>L;
    if(N<=L){
        cout << 1 << endl;
        return 0;
    }
    
    N = N/L + 1;
    cerr << N << endl;

    ll ans=2;
    ans = modpow(ans, N, mod);
    // cerr << ans << endl;
    // ans = (ans + MOD)%MOD;
    // cerr << ans << endl;
    cout << ans - 1 << endl;

}
0