#[allow(unused_imports)] use std::cmp::{max, min}; #[allow(unused_imports)] use std::collections::{HashMap, HashSet}; mod util { use std::io::stdin; use std::str::FromStr; use std::fmt::Debug; #[allow(dead_code)] pub fn line() -> String { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); line.trim().to_string() } #[allow(dead_code)] pub fn get() -> T where ::Err: Debug, { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); line.trim().parse().unwrap() } #[allow(dead_code)] pub fn gets() -> Vec where ::Err: Debug, { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); line.split_whitespace() .map(|t| t.parse().unwrap()) .collect() } #[allow(dead_code)] pub fn get2() -> (T, U) where ::Err: Debug, ::Err: Debug, { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap(), ) } } #[allow(unused_macros)] macro_rules! debug { ($x: expr) => { println!("{}: {:?}", stringify!($x), $x) } } fn f_large(n: usize) -> f64 { (1..n + 1) .map(|k| (0.81f64).powi(k as i32)) .sum::() .sqrt() / (1..n + 1).map(|k| (0.9f64).powi(k as i32)).sum::() } fn f(n: usize) -> f64 { let f_large_inf = (0.81f64 / 0.19).sqrt() / 9.0; (f_large(n) - f_large_inf) / (f_large(1) - f_large_inf) * 1200.0 } fn g(x: f64) -> f64 { (2.0f64).powf(x / 800.0) } fn g_inv(y: f64) -> f64 { 800.0 * y.ln() / (2.0f64).ln() } fn rating(perfs: &[f64]) -> f64 { let n = perfs.len(); g_inv( (1..n + 1) .map(|i| g(perfs[i - 1]) * (0.9f64).powi(i as i32)) .sum::() / (1..n + 1).map(|i| (0.9f64).powi(i as i32)).sum::(), ) - f(n) } fn main() { let n: usize = util::get(); let perfs: Vec = (0..n).map(|_| util::get::() as f64).collect(); println!("{}", rating(&perfs).round() as i64); }