結果

問題 No.1319 最強とんがりコーン
ユーザー akakimidoriakakimidori
提出日時 2020-12-16 01:00:31
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 2,300 bytes
コンパイル時間 1,905 ms
コンパイル使用メモリ 164,548 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 08:22:44
合計ジャッジ時間 39,339 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 549 ms
4,348 KB
testcase_03 AC 303 ms
4,348 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 601 ms
4,348 KB
testcase_07 AC 356 ms
4,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 111 ms
4,348 KB
testcase_11 AC 413 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 442 ms
4,348 KB
testcase_14 AC 173 ms
4,348 KB
testcase_15 AC 478 ms
4,348 KB
testcase_16 AC 201 ms
4,348 KB
testcase_17 WA -
testcase_18 AC 242 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 589 ms
4,348 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 415 ms
4,348 KB
testcase_41 AC 103 ms
4,348 KB
testcase_42 AC 156 ms
4,348 KB
testcase_43 AC 110 ms
4,348 KB
testcase_44 AC 165 ms
4,348 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 125 ms
4,348 KB
testcase_48 AC 413 ms
4,348 KB
testcase_49 AC 134 ms
4,348 KB
testcase_50 AC 118 ms
4,348 KB
testcase_51 AC 92 ms
4,348 KB
testcase_52 AC 110 ms
4,348 KB
testcase_53 WA -
testcase_54 AC 197 ms
4,348 KB
testcase_55 AC 162 ms
4,348 KB
testcase_56 AC 105 ms
4,348 KB
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 53 ms
4,348 KB
testcase_61 AC 52 ms
4,348 KB
testcase_62 AC 53 ms
4,348 KB
testcase_63 AC 53 ms
4,348 KB
testcase_64 AC 611 ms
4,348 KB
testcase_65 AC 613 ms
4,348 KB
testcase_66 AC 53 ms
4,348 KB
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 AC 134 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// ---------- begin input macro ----------
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, bytes) => {
        read_value!($iter, String).bytes().collect::<Vec<u8>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
// ---------- end input macro ----------

fn calc(d: f64) -> f64 {
    let mut sum = 0f64;
    let mut c = 0f64;
    let n = 50000000;
    let f = 1f64 / n as f64;
    for i in (0..n).rev() {
        let r = (n - i) as f64 * f;
        if 2.0 * r < d {
            continue;
        }
        let p = (d / 2.0 / r).acos() * 2.0;
        let pp = p * p;
        let mut v = 0f64;
        let m = 11;
        let mut de = 1.0 / (1..=m).fold(1f64, |s, a| s * a as f64);
        for i in 0..=((m - 3) / 2) {
            v = v * pp + de;
            de = -de * (m - 2 * i) as f64 * (m - 2 * i - 1) as f64;
        }
        v *= r * r * pp * p;
        let y = v - c;
        let t = sum + y;
        c = (t - sum) - y;
        sum = t;
    }
    sum * f
}

fn run() {
    input! {
        r: f64,
        h: f64,
        d: f64,
    }
    let ans = r * r * h * calc(d / r);
    println!("{:.7}", ans);
}

fn main() {
    run();
}
0