結果

問題 No.1184 Hà Nội
ユーザー tentententen
提出日時 2020-08-24 10:29:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 1,719 ms
コンパイル使用メモリ 74,864 KB
実行使用メモリ 55,160 KB
最終ジャッジ日時 2024-04-24 01:38:17
合計ジャッジ時間 5,949 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
53,112 KB
testcase_01 AC 112 ms
54,140 KB
testcase_02 AC 104 ms
53,096 KB
testcase_03 AC 103 ms
53,340 KB
testcase_04 AC 101 ms
52,804 KB
testcase_05 AC 102 ms
52,800 KB
testcase_06 AC 117 ms
54,384 KB
testcase_07 AC 106 ms
55,160 KB
testcase_08 AC 108 ms
53,084 KB
testcase_09 AC 113 ms
53,956 KB
testcase_10 AC 111 ms
53,724 KB
testcase_11 AC 103 ms
52,520 KB
testcase_12 AC 102 ms
52,720 KB
testcase_13 AC 106 ms
53,124 KB
testcase_14 AC 116 ms
53,984 KB
testcase_15 AC 105 ms
54,200 KB
testcase_16 AC 106 ms
53,100 KB
testcase_17 AC 103 ms
53,028 KB
testcase_18 AC 100 ms
53,036 KB
testcase_19 AC 104 ms
52,720 KB
testcase_20 AC 110 ms
54,164 KB
testcase_21 AC 112 ms
53,552 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 117 ms
54,116 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

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 % MOD;
        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