結果
問題 | No.273 回文分解 |
ユーザー |
![]() |
提出日時 | 2017-02-02 17:09:03 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 345 bytes |
コンパイル時間 | 46 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 24,704 KB |
最終ジャッジ日時 | 2024-12-24 03:53:28 |
合計ジャッジ時間 | 13,716 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 25 WA * 4 TLE * 3 |
コンパイルメッセージ
Syntax OK
ソースコード
s = gets.strip @len_max = 0 def search(s, len_max) #p s if s.length == 0 @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) end end end search(s, 0) p @len_max