結果
問題 | No.273 回文分解 |
ユーザー |
![]() |
提出日時 | 2017-02-06 13:12:29 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 429 bytes |
コンパイル時間 | 372 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-06-06 17:42:51 |
合計ジャッジ時間 | 4,001 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 75 ms
12,032 KB |
testcase_04 | AC | 72 ms
12,032 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 74 ms
12,160 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 73 ms
12,032 KB |
testcase_16 | AC | 72 ms
11,904 KB |
testcase_17 | AC | 75 ms
12,160 KB |
testcase_18 | WA | - |
testcase_19 | AC | 73 ms
12,160 KB |
testcase_20 | AC | 73 ms
12,160 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 95 ms
12,288 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | AC | 76 ms
12,160 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
コンパイルメッセージ
Syntax OK
ソースコード
def search(s, s_len, len_max, num) return if len_max > s_len && len_max < @len_max if s_len == 0 && num > 1 @len_max = [@len_max, len_max].max return end (1...s_len).each do |i| if s[0..i] == s[0..i].reverse len_max = [len_max, i + 1].max search(s[i + 1..-1], s_len - (i + 1), len_max, num + 1) end end end s = gets.strip @len_max = 0 if s.length == 2 puts '1' else search(s, s.length, 0, 0) p @len_max end