結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー tonyu0
提出日時 2020-04-05 13:55:27
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 12,815 ms
コンパイル使用メモリ 379,916 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-03 08:09:08
合計ジャッジ時間 13,468 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let k: usize = itr.next().unwrap().parse().unwrap();
    if k > n || k == 0 || n == 1 {
        println!("0");
    } else if n - k + 1 == k {
        println!("{}", n - 1);
    } else {
        println!("{}", n - 2);
    }
}
0