結果
| 問題 |
No.857 素振り
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-12 09:05:34 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,202 bytes |
| コンパイル時間 | 18,239 ms |
| コンパイル使用メモリ | 403,404 KB |
| 最終ジャッジ日時 | 2024-11-14 21:45:16 |
| 合計ジャッジ時間 | 19,092 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
error: use of deprecated `try` macro
--> src/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>())
| ++
warning: unnecessary trailing semicolon
--> src/main.rs:24:11
|
24 | )*;
| ^ help: remove this semicolon
...
51 | input!(x: i64, y: i64, z: i64);
| ------------------------------ in this macro invocation
|
= note: `#[warn(redundant_semicolons)]` on by default
= note: this warning originates in the macro `input` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0782]: trait objects must include the `dyn` keyword
--> src/main.rs:50:29
|
50 | fn solve() -> Result<(),Box<std::error::Error>>{
| ^^^^^^^^^^^^^^^^^
|
help: add `dyn` keyword before this trait
|
50 | fn solve() -> Result<(),Box<dyn std::error::Error>>{
| +++
For more information about this error, try `rustc --explain E0782`.
error: could not compile `main` (bin "main") due to 4 previous errors; 1 warning emitted
ソースコード
#![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(())
}