結果

問題 No.3033 Test of Russian
ユーザー lzy9lzy9
提出日時 2018-04-01 22:20:28
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 1,041 ms
コンパイル使用メモリ 153,004 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-08 12:38:26
合計ジャッジ時間 1,624 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused imports: `max`, `min`
 --> Main.rs:3:16
  |
3 | use std::cmp::{min, max};
  |                ^^^  ^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: variable `N` should have a snake case name
  --> Main.rs:18:9
   |
18 |     let N = read::<i32>();
   |         ^ help: convert the identifier to snake case: `n`
   |
   = note: `#[warn(non_snake_case)]` on by default

warning: variable `M` should have a snake case name
  --> Main.rs:19:9
   |
19 |     let M = read::<i32>();
   |         ^ help: convert the identifier to snake case: `m`

warning: variable `X` should have a snake case name
  --> Main.rs:20:9
   |
20 |     let X = read::<i32>();
   |         ^ help: convert the identifier to snake case (notice the capitalization): `x`

warning: 4 warnings emitted

ソースコード

diff #

use std::io::*;
use std::str::FromStr;
use std::cmp::{min, max};

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin_lock = stdin.lock();
    let s = stdin_lock
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    let N = read::<i32>();
    let M = read::<i32>();
    let X = read::<i32>();

    if 3 <= X - (N - M) {
        println!("YES");
    } else {
        println!("NO");
    }
}
0