結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2016-05-25 19:19:22 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 108 ms / 1,000 ms |
| コード長 | 188 bytes |
| コンパイル時間 | 88 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-06-24 23:51:03 |
| 合計ジャッジ時間 | 5,663 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
Syntax OK
ソースコード
# your code goes here
n=STDIN.gets.to_i
as=STDIN.gets.split(" ")
as.size.times do |i|
as[i]=as[i].to_i
end
as=as.sort()
if n%2==1
puts as[n/2]
else
puts (as[n/2-1]+as[n/2])/2.0
end
horiesiniti