結果
| 問題 | No.1617 Palindrome Removal |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-22 21:25:31 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 238 ms / 2,000 ms |
| + 678µs | |
| コード長 | 210 bytes |
| 記録 | |
| コンパイル時間 | 378 ms |
| コンパイル使用メモリ | 8,576 KB |
| 実行使用メモリ | 69,376 KB |
| 最終ジャッジ日時 | 2026-08-15 17:26:04 |
| 合計ジャッジ時間 | 5,688 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
コンパイルメッセージ
Main.rb:7: warning: ambiguous first argument; put parentheses or a space even after `-` operator Main.rb:12: warning: ambiguous first argument; put parentheses or a space even after `-` operator Syntax OK
ソースコード
S = gets.chomp
T = S.chars.tally
if S != S.reverse
puts S.size
elsif T.size >= 2
if S.size == 3
puts -1
else
puts S.size - 2
end
elsif S.size.odd?
puts -1
else
puts 0
end