結果

問題 No.857 素振り
ユーザー HaarHaar
提出日時 2019-10-12 09:05:34
言語 Rust
(1.77.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,202 bytes
コンパイル時間 3,326 ms
コンパイル使用メモリ 79,708 KB
最終ジャッジ日時 2023-08-18 06:19:48
合計ジャッジ時間 4,001 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
error: use of deprecated `try` macro
  --> Main.rs:15:13
   |
15 |             try!(token.parse::<$t>())
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
...
51 |     input!(x: i64, y: i64, z: i64);
   |     ------------------------------ in this macro invocation
   |
   = note: in the 2018 edition `try` is a reserved keyword, and the `try!()` macro is deprecated
   = note: this error originates in the macro `get` which comes from the expansion of the macro `input` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can use the `?` operator instead
   |
15 -             try!(token.parse::<$t>())
15 +             token.parse::<$t>()?
   |
help: alternatively, you can still access the deprecated `try!()` macro using the "raw identifier" syntax
   |
15 |             r#try!(token.parse::<$t>())
   |             ++

error: use of deprecated `try` macro
  --> Main.rs:15:13
   |
15 |             try!(token.parse::<$t>())
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
...
51 |     input!(x: i64, y: i64, z: i64);
   |     ------------------------------ in this macro invocation
   |
   = note: in the 2018 edition `try` is a reserved keyword, and the `try!()` macro is deprecated
   = note: this error originates in the macro `get` which comes from the expansion of the macro `input` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can use the `?` operator instead
   |
15 -             try!(token.parse::<$t>())
15 +             token.parse::<$t>()?
   |
help: alternatively, you can still access the deprecated `try!()` macro using the "raw identifier" syntax
   |
15 |             r#try!(token.parse::<$t>())
   |             ++

error: use of deprecated `try` macro
  --> Main.rs:15:13
   |
15 |             try!(token.parse::<$t>())
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
...
51 |     input!(x: i64, y: i64, z: i64);
   |     ------------------------------ in this macro invocation
   |
   = note: in the 2018 edition `try` is a reserved keyword, a

ソースコード

diff #

#![allow(unused_imports, unused_macros, dead_code, bare_trait_objects)]

macro_rules! get{
    ($t:ty) => {
        {
            let cin = stdin();
            let mut cin = cin.lock();
            
            let token =
                cin.by_ref().bytes().map(|c| c.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect::<String>();

            try!(token.parse::<$t>())
        }
    }
}

macro_rules! input{
    ($($id:ident: $t:ty),*) => {
        $(
            let $id = get!($t);
        )*;
    }
}

macro_rules! input_vec{
    ($id:ident: Vec<$t:ty>, $n:expr) => {
        let n = $n;
        let mut $id: Vec<$t> = Vec::with_capacity(n);
        for _ in 0..n {
            let temp = get!($t);
            $id.push(temp);
        }
    }
}

use std::io::{Read,stdin};
use std::str::*;
use std::error::Error;
use std::fmt::Debug;
use std::ops::*;


fn main(){
    while let Ok(_) = solve() {}
}

fn solve() -> Result<(),Box<std::error::Error>>{
    input!(x: i64, y: i64, z: i64);

    let mut ans = z;
    if x <= z {ans -= 1;}
    if y <= z {ans -= 1;}

    println!("{}", ans);

    Ok(())
}
0