結果

問題 No.1020 Reverse
ユーザー 👑 horiesinitihoriesiniti
提出日時 2023-02-08 05:39:25
言語 Ruby
(3.3.0)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 153 bytes
コンパイル時間 63 ms
コンパイル使用メモリ 11,400 KB
実行使用メモリ 16,040 KB
最終ジャッジ日時 2023-09-19 08:47:17
合計ジャッジ時間 3,306 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
15,256 KB
testcase_01 AC 84 ms
15,224 KB
testcase_02 AC 84 ms
15,296 KB
testcase_03 AC 85 ms
15,060 KB
testcase_04 AC 84 ms
15,208 KB
testcase_05 AC 88 ms
15,040 KB
testcase_06 AC 85 ms
15,096 KB
testcase_07 AC 85 ms
15,600 KB
testcase_08 AC 83 ms
15,692 KB
testcase_09 AC 85 ms
15,756 KB
testcase_10 AC 85 ms
15,968 KB
testcase_11 AC 84 ms
15,928 KB
testcase_12 AC 85 ms
15,864 KB
testcase_13 AC 84 ms
15,664 KB
testcase_14 AC 84 ms
16,040 KB
testcase_15 AC 86 ms
15,728 KB
testcase_16 AC 85 ms
15,704 KB
testcase_17 AC 84 ms
15,612 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,m=gets.split(" ").map{|e| e.to_i}
s=gets.chomp
if n==m then
	puts s.reverse
else
	s2=s[0,m-1]
	s3=s[m-1,n]
	s2=s2.reverse if (n-m)%2==0
	puts s3+s2
end
0