結果
| 問題 |
No.238 Mr. K's Another Gift
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-11-02 11:08:23 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 258 bytes |
| コンパイル時間 | 69 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-10-11 09:27:56 |
| 合計ジャッジ時間 | 7,209 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 WA * 6 |
コンパイルメッセージ
Syntax OK
ソースコード
S = gets.chomp
RS = S.reverse
N = S.size
if S == RS
l = N / 2
S.insert(l, S[l])
puts S
else
idx = (0...N).find { |i| S[i] != RS[i] }
r_idx = N - idx - 1
S.insert(r_idx + 1, S[idx])
if S == S.reverse
puts S
else
puts 'NA'
end
end
siman