結果

問題 No.273 回文分解
ユーザー akko_yukky
提出日時 2017-05-31 11:45:38
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-09-21 20:18:16
合計ジャッジ時間 4,398 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 28 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:23: warning: `elsif' at the end of line without an expression
Syntax OK

ソースコード

diff #

s=gets

if s==s.reverse then
  if s.length == 2 then
    puts 1
    exit
  end
  puts s.length-2
  return
end

pos = Array.new()
for i in (0..s.length-1)
        for j in (i+1..s.length-1)
                if s[i..j] == s[i..j].reverse then
                        pos.push(j-i+1)
                end
        end
end

if pos.length == 0 then
  puts 1
elsif
  puts pos.max
end
0