結果

問題 No.1020 Reverse
ユーザー yosakayosaka
提出日時 2020-04-11 01:39:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 245 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 10,540 KB
実行使用メモリ 13,272 KB
最終ジャッジ日時 2023-10-14 11:58:49
合計ジャッジ時間 1,681 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,492 KB
testcase_01 AC 18 ms
8,532 KB
testcase_02 AC 18 ms
8,440 KB
testcase_03 WA -
testcase_04 AC 18 ms
8,456 KB
testcase_05 AC 18 ms
8,532 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 26 ms
12,184 KB
testcase_09 AC 25 ms
11,500 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 29 ms
13,000 KB
testcase_13 AC 29 ms
13,012 KB
testcase_14 WA -
testcase_15 AC 26 ms
11,512 KB
testcase_16 AC 26 ms
11,508 KB
testcase_17 AC 28 ms
13,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
from collections import deque
N, K = map(int, input().split())
S = list(input())
# T = deque(S)
if N-K == 0:
    ans = S[::-1]
elif (N-K) % 2 == 0:
    ans = S[K-2:] + S[:K-2]
else:
    ans = S[K-1:] + S[:K-1]
print("".join(ans))
0