use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; struct Input { n: usize, a: Vec, } fn read_input(cin_lock: &mut StdinLock) -> Input { let n = next_token(cin_lock); Input { n, a: next_vector_token(cin_lock, n), } } fn solve(mut input: Input) { input.a.sort(); let ans = match input.n % 2 { 0 => { let a0 = input.a[input.n / 2 - 1]; let a1 = input.a[input.n / 2]; ((a0 + a1) as f32) / 2.0 } _ => input.a[input.n / 2] as f32, }; println!("{}", ans); } fn next_token(cin_lock: &mut StdinLock) -> T { cin_lock .by_ref() .bytes() .map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::() .parse::() .ok() .unwrap() } fn next_vector_token(cin_lock: &mut StdinLock, n: usize) -> Vec { let cin = cin_lock.by_ref(); (0..n) .map(|_| { cin.bytes() .map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::() .parse::() .ok() .unwrap() }) .collect() } fn main() { let cin = stdin(); let mut cin_lock = cin.lock(); let input = read_input(&mut cin_lock); solve(input); }