結果

問題 No.1020 Reverse
ユーザー roarisroaris
提出日時 2020-12-19 20:28:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 747 ms
コンパイル使用メモリ 81,656 KB
実行使用メモリ 80,024 KB
最終ジャッジ日時 2023-10-21 09:30:37
合計ジャッジ時間 2,393 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,456 KB
testcase_01 AC 38 ms
53,456 KB
testcase_02 AC 40 ms
53,456 KB
testcase_03 AC 39 ms
53,456 KB
testcase_04 AC 38 ms
53,456 KB
testcase_05 AC 38 ms
53,456 KB
testcase_06 AC 38 ms
53,456 KB
testcase_07 AC 53 ms
70,424 KB
testcase_08 AC 53 ms
72,656 KB
testcase_09 AC 47 ms
66,808 KB
testcase_10 AC 59 ms
79,988 KB
testcase_11 AC 59 ms
77,336 KB
testcase_12 AC 56 ms
77,380 KB
testcase_13 AC 57 ms
76,608 KB
testcase_14 AC 57 ms
76,624 KB
testcase_15 AC 50 ms
69,300 KB
testcase_16 AC 50 ms
69,368 KB
testcase_17 AC 59 ms
80,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, K = map(int, input().split())
S = input()[:-1]
ans = []

for i in range(K-1, N):
    ans.append(S[i])

if (N-K+1)%2==0:
    ans += list(S[:K-1])
else:
    ans += list(reversed(S[:K-1]))

print(''.join(ans))
0