結果

問題 No.1020 Reverse
ユーザー da_louisda_louis
提出日時 2020-04-10 21:48:10
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 303 bytes
コンパイル時間 13,578 ms
コンパイル使用メモリ 421,268 KB
実行使用メモリ 57,812 KB
最終ジャッジ日時 2023-10-14 00:15:32
合計ジャッジ時間 21,651 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 301 ms
52,900 KB
testcase_02 AC 297 ms
52,796 KB
testcase_03 WA -
testcase_04 AC 312 ms
53,132 KB
testcase_05 WA -
testcase_06 AC 304 ms
52,900 KB
testcase_07 WA -
testcase_08 AC 417 ms
57,096 KB
testcase_09 WA -
testcase_10 AC 433 ms
57,724 KB
testcase_11 WA -
testcase_12 AC 411 ms
56,908 KB
testcase_13 WA -
testcase_14 AC 418 ms
57,632 KB
testcase_15 AC 410 ms
54,956 KB
testcase_16 AC 412 ms
55,036 KB
testcase_17 AC 416 ms
57,812 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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()!!

    if (n == k) return println(s.reversed())

    val answer = s.drop(k - 1) + s.take(k - 1).let { if (k % 2 == 0) it else it.reversed() }

    println(answer)
}
0