結果

問題 No.825 賢いお買い物
ユーザー kawadumaxkawadumax
提出日時 2019-05-18 18:44:40
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 859 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 170,260 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 07:39:39
合計ジャッジ時間 1,576 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 0 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: function `read_vec2` is never used
  --> Main.rs:13:4
   |
13 | fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
   |    ^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

ソースコード

diff #

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let v = read_vec::<u8>();
    let (a, b, c) = (v[0], v[1], v[2]);
    if a + b < c {
        println!("Impossible");
        return();
    }
    let sub = a + b - c;
    if sub < a {
        println!("{}", sub);
        return();
    } else if sub >= a {
        println!("{}", a + 10 * (sub - a));
        return();
    }
}
0