結果

問題 No.32 貯金箱の憂鬱
ユーザー hitoyozakehitoyozake
提出日時 2018-05-03 21:54:36
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 622 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 135,404 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-30 13:09:43
合計ジャッジ時間 1,193 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 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
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `x`
 --> Main.rs:7:9
  |
7 |     let x = std::io::stdin().read_line(& mut buf).ok();
  |         ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

ソースコード

diff #



fn read_line()->String{
    let mut buf = String::new();

    let x = std::io::stdin().read_line(& mut buf).ok();

    buf
}



fn main() {
    let mut n = read_line().trim().parse::<i32>().unwrap();
    let mut m = read_line().trim().parse::<i32>().unwrap();
    let mut l = read_line().trim().parse::<i32>().unwrap();

    m = m + l / 25; // 25円玉に1円玉を両替した結果を反映
    l = l % 25; // 両替したのでその分減らす(あまり)
    n = n + m/4; // 25*4 -> 100円にする
    m = m % 4;
    n = n % 10;
    //println!("l:{}, m:{}, n:{}", l, m, n);

    println!("{}", l + m + n);
    
}
0