結果

問題 No.1020 Reverse
ユーザー MaboyMaboy
提出日時 2021-06-28 23:49:25
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 269 bytes
コンパイル時間 8,551 ms
コンパイル使用メモリ 172,072 KB
実行使用メモリ 14,584 KB
最終ジャッジ日時 2023-09-08 00:06:01
合計ジャッジ時間 3,964 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
13,520 KB
testcase_01 AC 6 ms
13,616 KB
testcase_02 AC 6 ms
13,556 KB
testcase_03 AC 6 ms
13,608 KB
testcase_04 WA -
testcase_05 AC 5 ms
13,500 KB
testcase_06 WA -
testcase_07 AC 12 ms
13,580 KB
testcase_08 WA -
testcase_09 AC 8 ms
13,576 KB
testcase_10 WA -
testcase_11 AC 21 ms
14,016 KB
testcase_12 WA -
testcase_13 AC 8 ms
13,780 KB
testcase_14 WA -
testcase_15 AC 33 ms
14,320 KB
testcase_16 WA -
testcase_17 AC 7 ms
13,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import Foundation
let n = readLine()!.split(separator: " ").map{Int($0)!}
var S = String(readLine()!)
let (N,K) = (n[0],n[1])
let s = S.index(S.startIndex, offsetBy: K-1)
var T = String(S[..<s])
let U = S[s...]
if K % 2 == 0{
    T = String(T.reversed())
}
print(U + T)
0