結果
問題 | No.273 回文分解 |
ユーザー |
|
提出日時 | 2016-06-13 14:20:40 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 103 ms / 2,000 ms |
コード長 | 303 bytes |
コンパイル時間 | 42 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-06-25 13:37:07 |
合計ジャッジ時間 | 4,453 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
Syntax OK
ソースコード
def iskb(str)n=str.sizereturn true if n==10.upto(n/2){|i|return false if str[i]!=str[n-i-1]}return trueends = gets.chompn = s.sizemax=10.upto(n-2){|i|i.upto(n-1){|j|next if i==0 && j==n-1max=j-i+1 if iskb(s[i..j]) && max<j-i+1}}p max