結果

問題 No.1020 Reverse
ユーザー brthyyjpbrthyyjp
提出日時 2020-04-10 21:29:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 173 bytes
コンパイル時間 1,386 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 84,116 KB
最終ジャッジ日時 2023-10-13 23:20:30
合計ジャッジ時間 3,694 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,320 KB
testcase_01 AC 66 ms
70,984 KB
testcase_02 AC 66 ms
71,256 KB
testcase_03 AC 65 ms
71,384 KB
testcase_04 AC 64 ms
71,248 KB
testcase_05 AC 65 ms
71,192 KB
testcase_06 AC 65 ms
71,256 KB
testcase_07 AC 83 ms
79,928 KB
testcase_08 AC 72 ms
77,360 KB
testcase_09 AC 70 ms
75,388 KB
testcase_10 AC 79 ms
83,712 KB
testcase_11 AC 81 ms
83,912 KB
testcase_12 AC 75 ms
79,048 KB
testcase_13 AC 75 ms
79,344 KB
testcase_14 AC 80 ms
84,116 KB
testcase_15 AC 78 ms
83,164 KB
testcase_16 AC 79 ms
83,336 KB
testcase_17 AC 74 ms
79,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
s = list(str(input()))

if (n-k+1)%2 == 0:
    ans = s[k-1:]+s[0:k-1]
else:
    ans = s[k-1:]+list(reversed(s[0:k-1]))

print(''.join(ans))
0