結果

問題 No.588 空白と回文
ユーザー cielciel
提出日時 2017-11-08 01:34:31
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 188 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-05-03 07:01:11
合計ジャッジ時間 4,494 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
12,032 KB
testcase_01 AC 88 ms
12,032 KB
testcase_02 AC 89 ms
12,288 KB
testcase_03 WA -
testcase_04 AC 91 ms
12,288 KB
testcase_05 AC 93 ms
12,160 KB
testcase_06 AC 93 ms
12,032 KB
testcase_07 AC 89 ms
12,160 KB
testcase_08 AC 90 ms
12,032 KB
testcase_09 AC 89 ms
12,032 KB
testcase_10 AC 89 ms
12,032 KB
testcase_11 WA -
testcase_12 AC 277 ms
12,288 KB
testcase_13 WA -
testcase_14 AC 91 ms
12,032 KB
testcase_15 WA -
testcase_16 AC 90 ms
12,288 KB
testcase_17 AC 209 ms
12,416 KB
testcase_18 AC 91 ms
12,416 KB
testcase_19 AC 90 ms
12,160 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(a,b)
	return 0 if a<0 || S.size<=b
	f(a-1,b+1)+(S[a]==S[b] ? 2 : 0)
end
S=gets.chomp
r=0
(0...S.size).each{|i|r=[r,1+f(i-1,i+1)].max}
(0...S.size-1).each{|i|r=[r,1+f(i,i+1)].max}
p r
0