結果
問題 | No.273 回文分解 |
ユーザー |
|
提出日時 | 2017-05-31 11:48:56 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 382 bytes |
コンパイル時間 | 66 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-06-25 13:52:39 |
合計ジャッジ時間 | 4,171 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
Main.rb:23: warning: `elsif' at the end of line without an expression Syntax OK
ソースコード
s=gets.chompif s==s.reverse thenif s.length == 2 thenputs 1returnendputs s.length-2returnendpos = 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 thenpos.push(j-i+1)endendendif pos.length == 0 thenputs 1elsifputs pos.maxend