結果
問題 |
No.275 中央値を求めよ
|
ユーザー |
![]() |
提出日時 | 2022-11-23 19:34:18 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 399 bytes |
コンパイル時間 | 13,935 ms |
コンパイル使用メモリ | 383,652 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 00:09:26 |
合計ジャッジ時間 | 15,293 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
use std::io; fn main() { io::stdin().read_line(&mut String::new()).ok(); let mut a = String::new(); io::stdin().read_line(&mut a).ok(); let mut a = a .split_whitespace() .map(|n| n.parse::<f64>().unwrap()) .collect::<Vec<_>>(); a.sort_unstable_by(|a, b| a.partial_cmp(b).unwrap()); println!("{}", (a[(a.len() - 1) / 2] + a[a.len() / 2]) / 2f64); }