結果

問題 No.1184 Hà Nội
ユーザー tenten
提出日時 2020-08-24 10:33:18
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 2,270 ms
コンパイル使用メモリ 74,060 KB
実行使用メモリ 54,160 KB
最終ジャッジ日時 2024-11-06 08:22:34
合計ジャッジ時間 7,381 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MOD = 998244353;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long l = sc.nextLong();
        long count = (n + l - 1) / l;
        System.out.println((pow(2, count) - 1 + MOD) % MOD);
    }
    
    static long pow(long x, long y) {
        if (y == 0) {
            return 1;
        } else if (y % 2 == 0) {
            return pow(x * x % MOD, y / 2);
        } else {
            return pow(x, y - 1) * x % MOD;
        }
    }
}
0