結果

問題 No.1617 Palindrome Removal
ユーザー maguroflymagurofly
提出日時 2021-07-22 21:24:05
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 154 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 11,124 KB
実行使用メモリ 68,972 KB
最終ジャッジ日時 2023-09-24 15:26:46
合計ジャッジ時間 7,398 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 333 ms
66,208 KB
testcase_01 AC 346 ms
68,972 KB
testcase_02 AC 338 ms
66,588 KB
testcase_03 AC 330 ms
66,324 KB
testcase_04 AC 344 ms
68,904 KB
testcase_05 AC 302 ms
58,884 KB
testcase_06 AC 361 ms
68,784 KB
testcase_07 AC 256 ms
49,200 KB
testcase_08 AC 78 ms
15,168 KB
testcase_09 AC 77 ms
15,064 KB
testcase_10 AC 340 ms
65,388 KB
testcase_11 AC 318 ms
59,128 KB
testcase_12 AC 354 ms
68,876 KB
testcase_13 AC 359 ms
68,924 KB
testcase_14 AC 76 ms
15,056 KB
testcase_15 AC 77 ms
15,208 KB
testcase_16 AC 77 ms
14,988 KB
testcase_17 AC 78 ms
15,140 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 77 ms
15,176 KB
testcase_21 AC 78 ms
15,148 KB
testcase_22 AC 77 ms
14,984 KB
testcase_23 AC 76 ms
15,236 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:8: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

S = gets.chomp
T = S.chars.tally
if S != S.reverse
    puts S.size
elsif T.size >= 2
    puts S.size - 2
elsif S.size.odd?
    puts -1
else
    puts 0
end
0