結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー realjpn
提出日時 2017-09-03 07:56:48
言語 Ruby
(3.4.1)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-11-06 19:43:31
合計ジャッジ時間 3,490 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
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