結果

問題 No.1184 Hà Nội
ユーザー tentententen
提出日時 2020-08-24 10:33:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 2,901 ms
コンパイル使用メモリ 74,392 KB
実行使用メモリ 54,368 KB
最終ジャッジ日時 2024-04-24 01:43:40
合計ジャッジ時間 7,752 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
54,368 KB
testcase_01 AC 133 ms
53,812 KB
testcase_02 AC 135 ms
54,200 KB
testcase_03 AC 134 ms
53,892 KB
testcase_04 AC 137 ms
54,036 KB
testcase_05 AC 137 ms
54,008 KB
testcase_06 AC 133 ms
54,276 KB
testcase_07 AC 134 ms
54,180 KB
testcase_08 AC 133 ms
54,076 KB
testcase_09 AC 132 ms
53,800 KB
testcase_10 AC 132 ms
53,840 KB
testcase_11 AC 135 ms
54,044 KB
testcase_12 AC 133 ms
53,936 KB
testcase_13 AC 135 ms
53,888 KB
testcase_14 AC 135 ms
54,260 KB
testcase_15 AC 134 ms
54,044 KB
testcase_16 AC 135 ms
53,996 KB
testcase_17 AC 138 ms
53,916 KB
testcase_18 AC 133 ms
54,296 KB
testcase_19 AC 131 ms
54,092 KB
testcase_20 AC 134 ms
54,060 KB
testcase_21 AC 134 ms
54,088 KB
testcase_22 AC 135 ms
54,048 KB
testcase_23 AC 133 ms
53,836 KB
testcase_24 AC 133 ms
54,060 KB
testcase_25 AC 132 ms
54,024 KB
testcase_26 AC 134 ms
54,144 KB
testcase_27 AC 133 ms
53,944 KB
testcase_28 AC 132 ms
53,912 KB
権限があれば一括ダウンロードができます

ソースコード

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