結果

問題 No.1020 Reverse
ユーザー da_louisda_louis
提出日時 2020-04-10 21:36:45
言語 Kotlin
(1.9.23)
結果
TLE  
実行時間 -
コード長 378 bytes
コンパイル時間 16,741 ms
コンパイル使用メモリ 421,892 KB
実行使用メモリ 57,800 KB
最終ジャッジ日時 2023-10-13 23:38:38
合計ジャッジ時間 23,078 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 328 ms
56,708 KB
testcase_01 AC 329 ms
56,856 KB
testcase_02 AC 330 ms
56,796 KB
testcase_03 AC 428 ms
57,424 KB
testcase_04 AC 334 ms
56,848 KB
testcase_05 AC 425 ms
57,800 KB
testcase_06 AC 346 ms
57,352 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) = p1020()
         ^

ソースコード

diff #

fun main(args: Array<String>) = p1020()

fun p1020() {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val s = readLine()!!.toCharArray()

    for (i in 0..n - k) {
        val slice = s.slice(i until i + k).reversed()
        for (j in i until i + k) {
            s[j] = slice[j - i]
        }
    }

    val answer = s.joinToString("")

    println(answer)
}
0