結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー realjpn
提出日時 2017-09-03 07:40:46
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 310 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-11-06 19:43:27
合計ジャッジ時間 3,698 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

line = gets.chomp.split(" ")
box_num = line[0].to_i
out_num = line[1].to_i

if box_num.even? && box_num > out_num && out_num != 0
	puts box_num - 2
elsif box_num >= out_num && out_num != 0
	center_num = box_num / 2 + 1
	if out_num == center_num
		puts box_num - 1
	else
		puts box_num - 2
	end
else
	puts 0
end
0