結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-31 11:48:56 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 89 ms / 2,000 ms |
| コード長 | 382 bytes |
| コンパイル時間 | 66 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-06-25 13:52:39 |
| 合計ジャッジ時間 | 4,171 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
コンパイルメッセージ
Main.rb:23: warning: `elsif' at the end of line without an expression Syntax OK
ソースコード
s=gets.chomp
if s==s.reverse then
if s.length == 2 then
puts 1
return
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