https://atcoder.jp/contests/typical90/tasks/typical90_r
素直に座標計算するだけですね。
// Statue of Chokudai #![allow(non_snake_case)] //////////////////// library //////////////////// fn read<T: std::str::FromStr>() -> T { let mut line = String::new(); std::io::stdin().read_line(&mut line).ok(); line.trim().parse().ok().unwrap() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { read::<String>().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() } //////////////////// process //////////////////// fn read_input() -> (i32, i32, i32, i32, usize) { let T = read(); let v = read_vec(); let (L, X, Y) = (v[0], v[1], v[2]); let Q = read(); (T, L, X, Y, Q) } fn F(T: i32, L: i32, X: i32, Y: i32, Q: usize) { let pi = std::f64::consts::PI; let R = (L as f64) / 2.0; for _ in 0..Q { let E: i32 = read(); let theta = (E as f64) / (T as f64) * pi * 2.0; let Y1 = -R * f64::sin(theta); let Z1 = R - R * f64::cos(theta); let dY = Y1 - (Y as f64); let W = f64::sqrt((X as f64).powf(2.0) + dY*dY); let alpha = f64::atan2(Z1, W) * 180.0 / pi; println!("{}", alpha) } } fn main() { let (T, L, X, Y, Q) = read_input(); F(T, L, X, Y, Q) }