fn main(){ let mut sc = Scanner::new(); while !sc.eof() { let n = sc.next(); let s = sc.next(); let wid = sc.next(); let mut a = vec![0; n]; for i in 0..n { a[i] = sc.next(); } let wscore = 100*s + a[wid]; let mut p = 1.0; for i in 0..n { if i == wid { continue; } let mut left = 0; let mut right = n; while left + 1 < right { let mid = (left + right) / 2; if a[i] + score(mid, s) > wscore { left = mid; } else { right = mid; } } let x = 1.0 - left as f64 / (n-1) as f64; p *= x; } println!("{:.10}", p); } } fn score(rank: usize, star: i32) -> i32 { return 50*star + 500*star / (8 + 2*rank as i32); } // Scanner struct Scanner { token_buffer: Vec, index: usize } #[allow(dead_code)] impl Scanner { fn new() -> Scanner { Scanner { token_buffer: vec![], index: 0 } } fn next(&mut self) -> T where T: std::str::FromStr { self.wrapped::().unwrap() } fn wrapped(&mut self) -> Option where T: std::str::FromStr { match self.get_token() { Some(s) => { match s.parse::() { Ok(x) => Some(x), Err(_) => None } }, None => None } } fn eof(&mut self) -> bool { if !self.read_line() { true } else { self.index >= self.token_buffer.len() } } fn get_token(&mut self) -> Option<&String> { if !self.read_line() { None } else { self.index += 1; Some(&self.token_buffer[self.index - 1]) } } fn read_line(&mut self) -> bool { while self.index >= self.token_buffer.len() { let mut st = String::new(); while st.trim() == "" { match std::io::stdin().read_line(&mut st) { Ok(l) if l > 0 => continue, _ => return false } } self.token_buffer = st.split_whitespace() .map(|x| x.to_string()) .collect(); self.index = 0; } true } }