結果

問題 No.275 中央値を求めよ
ユーザー KamiKami
提出日時 2018-05-03 23:52:49
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 236 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-06-28 00:54:23
合計ジャッジ時間 4,742 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - num
Syntax OK

ソースコード

diff #

num = gets.to_i

num_array = []
num_array = gets.split.map(&:to_i)

num_array.sort!

if num_array.length.odd?
	puts num_array[num_array.length - 2]
else
	puts (num_array[num_array.length/2] + num_array[num_array.length/2 - 1]) / 2.0
end
0