結果

問題 No.892 タピオカ
ユーザー alcheminalchemin
提出日時 2019-11-24 17:50:14
言語 Rust
(1.77.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 1,693 bytes
コンパイル時間 23,631 ms
コンパイル使用メモリ 376,832 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 04:20:09
合計ジャッジ時間 17,604 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,248 KB
testcase_03 AC 1 ms
5,248 KB
testcase_04 AC 1 ms
5,248 KB
testcase_05 AC 1 ms
5,248 KB
testcase_06 AC 1 ms
5,248 KB
testcase_07 AC 1 ms
5,248 KB
testcase_08 AC 1 ms
5,248 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `b1`
  --> src/main.rs:57:13
   |
57 |             b1:i32,
   |             ^^
   |
help: `b1` is captured in macro and introduced a unused variable
  --> src/main.rs:27:13
   |
27 |           let $var = read_value!($next, $t);
   |               ^^^^
...
55 | /     input!{
56 | |             a1:i32,
57 | |             b1:i32,
58 | |             a2:i32,
...  |
61 | |             b3:i32,
62 | |         }
   | |_________- in this macro invocation
   = note: `#[warn(unused_variables)]` on by default
   = note: this warning originates in the macro `input_inner` which comes from the expansion of the macro `input` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused variable: `b2`
  --> src/main.rs:59:13
   |
59 |             b2:i32,
   |             ^^
   |
help: `b2` is captured in macro and introduced a unused variable
  --> src/main.rs:27:13
   |
27 |           let $var = read_value!($next, $t);
   |               ^^^^
...
55 | /     input!{
56 | |             a1:i32,
57 | |             b1:i32,
58 | |             a2:i32,
...  |
61 | |             b3:i32,
62 | |         }
   | |_________- in this macro invocation
   = note: this warning originates in the macro `input_inner` which comes from the expansion of the macro `input` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused variable: `b3`
  --> src/main.rs:61:13
   |
61 |             b3:i32,
   |             ^^
   |
help: `b3` is captured in macro and introduced a unused variable
  --> src/main.rs:27:13
   |
27 |           let $var = read_value!($next, $t);
   |               ^^^^
...
55 | /     input!{
56 | |             a1:i32,
57 | |             b1:i32,
58 | |             a2:i32,
...  |
61 | |             b3:i32,
62 | |         }
   | |_________- in this macro invocation
   = note: this warning originates in the macro `input_inner` which comes from the expansion of the macro `input` (in Nightly builds, run with -Z macro-backtrace for 

ソースコード

diff #

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)*}
    };
}

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)*}
    };
}

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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

fn main(){
    input!{
            a1:i32,
            b1:i32,
            a2:i32,
            b2:i32,
            a3:i32,
            b3:i32,
        }

    let is_even = if (a1 + a2 + a3) % 2 == 0 { true } else { false };

    if is_even {
        println!(":-)");
    } else {
        println!(":-(");
    }
}
0