Problem:
Score : 400 points

Problem Statement

Takahashi has a water bottle with the shape of a rectangular prism whose base is a square of side a~\mathrm{cm} and whose height is b~\mathrm{cm}. (The thickness of the bottle can be ignored.)

We will pour x~\mathrm{cm}^3 of water into the bottle, and gradually tilt the bottle around one of the sides of the base.

When will the water be spilled? More formally, find the maximum angle in which we can tilt the bottle without spilling any water.

Constraints

All values in input are integers.

1 \leq a \leq 100

1 \leq b \leq 100

1 \leq x \leq a^2b

Input

Input is given from Standard Input in the following format:

a b x

Output

Print the maximum angle in which we can tilt the bottle without spilling any water, in degrees.
Your output will be judged as correct when the absolute or relative error from the judge's output is at most 10^{-6}.

Sample Input 1

2 2 4

Sample Output 1

45.0000000000

This bottle has a cubic shape, and it is half-full. The water gets spilled when we tilt the bottle more than 45 degrees.

Sample Input 2

12 21 10

Sample Output 2

89.7834636934

This bottle is almost empty. When the water gets spilled, the bottle is nearly horizontal.

Sample Input 3

3 1 8

Sample Output 3

4.2363947991

This bottle is almost full. When the water gets spilled, the bottle is still nearly vertical.

Solution in Rust (1.15.1) (judge verdict: Accepted)

use std::f64::consts::PI;


#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: f64,
        b: f64,
        x: f64,
    }
    let area = x / a;
    let half_pi = PI / 2.;
    let error = 1e-8;

    let mut theta_min = 0.;
    let mut theta_max = PI / 2.;
    loop {
        let theta = (theta_max + theta_min) / 2.;
        // println!("{} {}", theta_min, theta_max);
        // println!(" {}", theta);
        let px = b * theta.cos();
        let py = b * theta.sin();
        let l2b = a * ((theta + half_pi).sin() - theta.tan() * (theta + half_pi).cos());
        let l1x = py / (theta + half_pi).tan();
        let l2x = (py - l2b) / theta.tan();
        // println!("px={}, py={}", px, py);
        // println!("l1x={}, l2x={}, l2b={}", l1x, l2x, l2b);
        let area_theta = if l1x > l2x {
            let d = (l1x * l1x + py * py).sqrt();
            b * d / 2.
        } else {
            let dx = l2x - a * (theta + half_pi).cos();
            let dy = py - a * (theta + half_pi).sin();
            let d = (dx * dx + dy * dy).sqrt();
            a * (b + d) / 2.
        };
        // println!("{} {}", area, area_theta);
        if area_theta <= area {
            if area - area_theta < error {
                break;
            }
            theta_min = theta;
        } else {
            theta_max = theta;
        }
    }
    let theta = PI / 2. - (theta_max + theta_min) / 2.;
    println!("{}", theta / PI * 180.);
}