結果

問題 No.32 貯金箱の憂鬱
ユーザー mtwtkmanmtwtkman
提出日時 2019-10-13 22:25:06
言語 Rust
(1.77.0)
結果
RE  
実行時間 -
コード長 856 bytes
コンパイル時間 711 ms
コンパイル使用メモリ 143,436 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-22 17:42:59
合計ジャッジ時間 1,550 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 RE -
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 1 ms
4,380 KB
testcase_11 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, Read};

fn read_stdin() -> Vec<String> {
    let mut buffer = String::new();
    io::stdin().read_to_string(&mut buffer).ok();
    buffer.trim().split('\n').map(|s| s.to_string()).collect()
}

fn main() {
    let input: Vec<u8> = read_stdin().into_iter().map(|s| s.parse::<u8>().unwrap()).collect();

    let one = *&input[2];
    let exchanged_one: u8 = one / 25;
    let one_result: u8 = if exchanged_one > 0 { one % 25 } else { one };

    let twenty_five: u8 = *&input[1] + exchanged_one;
    let exchanged_twenty_five: u8 = twenty_five / 4;
    let twenty_five_result: u8 = if exchanged_twenty_five > 0 { twenty_five % 4 } else { twenty_five };

    let one_hundred: u8 = *&input[0] + exchanged_twenty_five;
    let one_hundred_result = one_hundred % 10;
    println!("{}", one_result + twenty_five_result + one_hundred_result);
}
0