結果

問題 No.275 中央値を求めよ
ユーザー KamiKamiKamiKami
提出日時 2018-05-03 23:52:49
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 236 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 11,384 KB
実行使用メモリ 15,416 KB
最終ジャッジ日時 2023-09-10 09:26:31
合計ジャッジ時間 5,139 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,188 KB
testcase_01 AC 80 ms
15,244 KB
testcase_02 AC 78 ms
15,164 KB
testcase_03 AC 77 ms
15,044 KB
testcase_04 AC 79 ms
15,192 KB
testcase_05 AC 83 ms
15,152 KB
testcase_06 AC 78 ms
15,204 KB
testcase_07 AC 80 ms
15,216 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 81 ms
15,140 KB
testcase_11 AC 81 ms
15,152 KB
testcase_12 AC 80 ms
15,240 KB
testcase_13 AC 80 ms
15,136 KB
testcase_14 AC 80 ms
15,252 KB
testcase_15 AC 82 ms
15,068 KB
testcase_16 AC 82 ms
15,040 KB
testcase_17 AC 81 ms
15,108 KB
testcase_18 AC 82 ms
15,164 KB
testcase_19 WA -
testcase_20 AC 80 ms
15,160 KB
testcase_21 AC 82 ms
15,088 KB
testcase_22 AC 81 ms
15,316 KB
testcase_23 WA -
testcase_24 AC 81 ms
15,160 KB
testcase_25 AC 81 ms
15,208 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 82 ms
15,336 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 81 ms
15,312 KB
testcase_38 AC 81 ms
15,052 KB
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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