結果

問題 No.892 タピオカ
ユーザー alcheminalchemin
提出日時 2019-11-24 17:41:24
言語 Rust
(1.77.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 1,669 bytes
コンパイル時間 13,662 ms
コンパイル使用メモリ 404,256 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 04:19:44
合計ジャッジ時間 13,767 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,820 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 1 ms
6,816 KB
testcase_03 AC 1 ms
6,820 KB
testcase_04 AC 1 ms
6,816 KB
testcase_05 AC 1 ms
6,816 KB
testcase_06 AC 1 ms
6,816 KB
testcase_07 AC 1 ms
6,816 KB
testcase_08 AC 1 ms
6,816 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `b2`
  --> src/main.rs:57:13
   |
57 |             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 | |             b2: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 | |             b2: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 | |             b2: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,
            b2:i32,
            a2:i32,
            b2:i32,
            a3:i32,
            b3:i32,
        }
    let odd = a1%2 + a2%2 + a3%2;

    if odd == 0 || odd == 2 {
        println!(":-)");
    } else {
        println!(":-(");
    }
}
0