結果

問題 No.538 N.G.S.
ユーザー guricerin
提出日時 2019-07-17 15:06:53
言語 Rust
(1.30.1)
結果
AC  
実行時間 3 ms
コード長 2,547 Byte
コンパイル時間 2,012 ms
使用メモリ 1,204 KB
最終ジャッジ日時 2019-07-17 15:06:56

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
00_sample_00.txt AC 2 ms
1,200 KB
00_sample_01.txt AC 1 ms
1,200 KB
00_sample_02.txt AC 2 ms
1,196 KB
00_sample_03.txt AC 2 ms
1,200 KB
01_hand_00.txt AC 2 ms
1,200 KB
01_hand_01.txt AC 2 ms
1,196 KB
01_hand_02.txt AC 2 ms
1,204 KB
01_hand_03.txt AC 2 ms
1,204 KB
01_hand_04.txt AC 2 ms
1,196 KB
01_hand_05.txt AC 2 ms
1,200 KB
01_hand_06.txt AC 2 ms
1,200 KB
01_hand_07.txt AC 2 ms
1,196 KB
02_random_00.txt AC 2 ms
1,196 KB
02_random_01.txt AC 2 ms
1,200 KB
02_random_02.txt AC 2 ms
1,200 KB
02_random_03.txt AC 2 ms
1,200 KB
02_random_04.txt AC 2 ms
1,200 KB
02_random_05.txt AC 2 ms
1,204 KB
02_random_06.txt AC 2 ms
1,200 KB
02_random_07.txt AC 2 ms
1,200 KB
03_tester_00.txt AC 2 ms
1,200 KB
03_tester_01.txt AC 2 ms
1,200 KB
03_tester_02.txt AC 2 ms
1,200 KB
03_tester_03.txt AC 2 ms
1,200 KB
03_tester_04.txt AC 2 ms
1,200 KB
03_tester_05.txt AC 2 ms
1,196 KB
03_tester_06.txt AC 2 ms
1,200 KB
03_tester_07.txt AC 2 ms
1,200 KB
03_tester_08.txt AC 2 ms
1,204 KB
03_tester_09.txt AC 3 ms
1,200 KB
03_tester_10.txt AC 2 ms
1,200 KB
03_tester_11.txt AC 2 ms
1,200 KB
03_tester_12.txt AC 2 ms
1,204 KB
03_tester_13.txt AC 2 ms
1,200 KB
03_tester_14.txt AC 2 ms
1,196 KB
03_tester_15.txt AC 2 ms
1,196 KB
03_tester_16.txt AC 2 ms
1,196 KB
03_tester_17.txt AC 2 ms
1,200 KB
03_tester_18.txt AC 3 ms
1,204 KB
03_tester_19.txt AC 1 ms
1,200 KB
03_tester_20.txt AC 3 ms
1,200 KB
03_tester_21.txt AC 2 ms
1,200 KB
03_tester_22.txt AC 2 ms
1,196 KB
03_tester_23.txt AC 2 ms
1,200 KB
03_tester_24.txt AC 2 ms
1,204 KB
03_tester_25.txt AC 2 ms
1,196 KB
99_challenge01.txt AC 2 ms
1,200 KB
99_challenge02.txt AC 2 ms
1,200 KB
99_system_test1.txt AC 2 ms
1,204 KB
99_system_test2.txt AC 3 ms
1,204 KB
99_system_test3.txt AC 3 ms
1,204 KB
99_system_test4.txt AC 2 ms
1,196 KB
99_system_test5.txt AC 2 ms
1,196 KB
99_system_test6.txt AC 3 ms
1,200 KB
99_system_test7.txt AC 2 ms
1,200 KB
テストケース一括ダウンロード

ソースコード

diff #
// Original: https://github.com/tanakh/competitive-rs
#[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")
    };
}

#[allow(dead_code)]
fn chmin<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x > y && {
        *x = y;
        true
    }
}

#[allow(dead_code)]
fn chmax<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x < y && {
        *x = y;
        true
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input! {
        bs:[f64;3]
    }

    let r = (bs[2] - bs[1]) / (bs[1] - bs[0]);
    let d = bs[1] - (r * bs[0]);
    let b3 = r * bs[2] + d;
    println!("{}", b3.round());
}
0