結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
Albatross_Rofl
|
| 提出日時 | 2016-10-05 20:24:56 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 162 bytes |
| コンパイル時間 | 117 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-11-21 17:24:11 |
| 合計ジャッジ時間 | 4,513 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 9 WA * 29 |
コンパイルメッセージ
Main.rb:6: warning: `-' after local variable or literal is interpreted as binary operator Main.rb:6: warning: even though it seems like unary operator Syntax OK
ソースコード
n = gets.to_i
ary = gets.chomp.split(" ").map(&:to_i)
if n % 2 == 0
a1 = n / 2
a2 = a1 -1
puts (ary[a1] + ary[a2]) / 2.0
else
b = n / 2
puts ary[b]
end
Albatross_Rofl