結果

問題 No.1184 Hà Nội
ユーザー face4face4
提出日時 2021-04-12 20:47:29
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 12,862 ms
コンパイル使用メモリ 416,856 KB
実行使用メモリ 55,060 KB
最終ジャッジ日時 2023-09-11 02:05:51
合計ジャッジ時間 23,044 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 289 ms
55,060 KB
testcase_01 AC 289 ms
53,184 KB
testcase_02 AC 292 ms
53,052 KB
testcase_03 AC 290 ms
52,872 KB
testcase_04 AC 292 ms
53,232 KB
testcase_05 AC 294 ms
52,976 KB
testcase_06 AC 292 ms
53,028 KB
testcase_07 AC 291 ms
53,044 KB
testcase_08 AC 292 ms
53,088 KB
testcase_09 AC 293 ms
52,960 KB
testcase_10 AC 289 ms
52,952 KB
testcase_11 AC 292 ms
53,280 KB
testcase_12 AC 294 ms
53,092 KB
testcase_13 AC 289 ms
53,024 KB
testcase_14 AC 289 ms
53,132 KB
testcase_15 AC 292 ms
52,972 KB
testcase_16 AC 289 ms
53,048 KB
testcase_17 AC 293 ms
52,876 KB
testcase_18 AC 292 ms
52,936 KB
testcase_19 AC 290 ms
53,180 KB
testcase_20 AC 291 ms
53,212 KB
testcase_21 AC 292 ms
53,112 KB
testcase_22 AC 293 ms
52,956 KB
testcase_23 AC 300 ms
52,864 KB
testcase_24 AC 298 ms
53,032 KB
testcase_25 AC 293 ms
52,920 KB
testcase_26 AC 294 ms
52,884 KB
testcase_27 AC 295 ms
52,864 KB
testcase_28 AC 291 ms
52,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

const val mod = 998244353

fun modpow(x: Long, n: Long ): Long {
    return when (n) {
        0L -> {
            1
        }
        1L -> {
            x
        }
        else -> {
            val tmp = modpow(x, n / 2)
            tmp * tmp % mod * (if (n % 2 == 1L) x else 1) % mod
        }
    }
}

fun main() {
    val (n, l) = readLine()!!.split(" ").map { it.toLong() }
    val beki = (n + l - 1) / l
    println((modpow(2,beki)+mod-1)%mod)
}
0