結果
問題 | No.273 回文分解 |
ユーザー |
![]() |
提出日時 | 2017-02-02 17:13:13 |
言語 | Ruby (3.4.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 412 bytes |
コンパイル時間 | 47 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 24,448 KB |
最終ジャッジ日時 | 2024-12-24 03:54:02 |
合計ジャッジ時間 | 13,551 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 TLE * 3 |
コンパイルメッセージ
Syntax OK
ソースコード
s = gets.strip @len_max = 0 def search(s, len_max, num) #p s if s.length == 0 && num > 1 @len_max = [@len_max, len_max].max #p @len_max return end (0...s.length).each do |i| if s[0..i] == s[0..i].reverse #print "#{s[0..i]} OK\n" len_max = [len_max, s[0..i].length].max search(s[i + 1..-1], len_max, num + 1) end end end if s.length == 2 puts "1" else search(s, 0, 0) p @len_max end