結果

問題 No.1319 最強とんがりコーン
ユーザー akakimidoriakakimidori
提出日時 2020-12-16 01:33:18
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 2,347 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 171,516 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 08:40:13
合計ジャッジ時間 52,321 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 786 ms
4,348 KB
testcase_03 AC 426 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 1,198 ms
4,348 KB
testcase_06 AC 850 ms
4,348 KB
testcase_07 AC 505 ms
4,348 KB
testcase_08 AC 875 ms
4,348 KB
testcase_09 AC 1,262 ms
4,348 KB
testcase_10 AC 156 ms
4,348 KB
testcase_11 AC 577 ms
4,348 KB
testcase_12 AC 947 ms
4,348 KB
testcase_13 AC 624 ms
4,348 KB
testcase_14 AC 242 ms
4,348 KB
testcase_15 AC 672 ms
4,348 KB
testcase_16 AC 280 ms
4,348 KB
testcase_17 WA -
testcase_18 AC 346 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 823 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 569 ms
4,348 KB
testcase_41 AC 139 ms
4,348 KB
testcase_42 AC 210 ms
4,348 KB
testcase_43 AC 145 ms
4,348 KB
testcase_44 AC 224 ms
4,348 KB
testcase_45 AC 112 ms
4,348 KB
testcase_46 AC 1,138 ms
4,348 KB
testcase_47 AC 178 ms
4,348 KB
testcase_48 AC 588 ms
4,348 KB
testcase_49 AC 191 ms
4,348 KB
testcase_50 AC 168 ms
4,348 KB
testcase_51 AC 130 ms
4,348 KB
testcase_52 AC 158 ms
4,348 KB
testcase_53 WA -
testcase_54 AC 280 ms
4,348 KB
testcase_55 AC 232 ms
4,348 KB
testcase_56 AC 148 ms
4,348 KB
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 73 ms
4,348 KB
testcase_61 AC 74 ms
4,348 KB
testcase_62 AC 73 ms
4,348 KB
testcase_63 AC 73 ms
4,348 KB
testcase_64 AC 870 ms
4,348 KB
testcase_65 AC 881 ms
4,348 KB
testcase_66 AC 74 ms
4,348 KB
testcase_67 WA -
testcase_68 AC 1,361 ms
4,348 KB
testcase_69 WA -
testcase_70 AC 191 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 n = 70000000;
    let f = 1f64 / n as f64;
    let de = (0..6).map(|k| ((!k & 1) * 2 - 1) as f64 / (1..=(2 * k + 3)).fold(1f64, |s, a| s * a as f64)).collect::<Vec<_>>();
    let func = |r: f64| -> f64 {
        let p = (d * 0.5 / r).acos() * 2.0;
        let pp = p * p;
        let mut v = 0f64;
        for de in de.iter().rev() {
            v = v * pp + *de;
        }
        v *= r * r * pp * p;
        v
    };
    let mut sum = 0f64;
    let mut c = 0f64;
    for i in (0..n).rev() {
        let r = (n - i) as f64 * f;
        if 2.0 * r < d {
            continue;
        }
        let v = func(r);
        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