結果

問題 No.1020 Reverse
ユーザー kohei2019kohei2019
提出日時 2021-01-11 19:16:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 209 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,952 KB
最終ジャッジ日時 2024-05-01 06:54:35
合計ジャッジ時間 2,716 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,880 KB
testcase_01 AC 33 ms
11,008 KB
testcase_02 AC 32 ms
11,008 KB
testcase_03 AC 32 ms
10,880 KB
testcase_04 AC 32 ms
11,008 KB
testcase_05 AC 32 ms
10,880 KB
testcase_06 AC 32 ms
10,880 KB
testcase_07 AC 100 ms
15,536 KB
testcase_08 AC 119 ms
17,324 KB
testcase_09 AC 91 ms
16,252 KB
testcase_10 AC 149 ms
18,724 KB
testcase_11 AC 140 ms
18,952 KB
testcase_12 AC 136 ms
18,948 KB
testcase_13 AC 141 ms
18,948 KB
testcase_14 AC 139 ms
18,952 KB
testcase_15 AC 112 ms
18,108 KB
testcase_16 AC 113 ms
18,328 KB
testcase_17 AC 166 ms
18,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy
N,K = map(int,input().split())
S = list(input())
ans = []
for i in range(N-K+1):
    ans.append(S[i+K-1])
if (N+K) % 2 == 0:
    ans += reversed(S[:K-1])
else:
    ans += S[:K-1]
print(*ans,sep='')
0