結果
問題 | No.273 回文分解 |
ユーザー |
|
提出日時 | 2017-05-31 11:46:28 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 377 bytes |
コンパイル時間 | 161 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-09-21 20:18:32 |
合計ジャッジ時間 | 4,161 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 28 WA * 4 |
コンパイルメッセージ
Main.rb:23: warning: `elsif' at the end of line without an expression Syntax OK
ソースコード
s=gets if s==s.reverse then # if s.length == 2 then # puts 1 # return # end puts s.length-2 return end pos = Array.new() for i in (0..s.length-1) for j in (i+1..s.length-1) if s[i..j] == s[i..j].reverse then pos.push(j-i+1) end end end if pos.length == 0 then puts 1 elsif puts pos.max end