結果

問題 No.289 数字を全て足そう
ユーザー halship
提出日時 2020-10-23 21:42:06
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 488 bytes
コンパイル時間 14,494 ms
コンパイル使用メモリ 390,576 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-21 10:27:18
合計ジャッジ時間 14,773 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, BufReader, BufWriter, Read, Write};

fn main() {
    let stdin = io::stdin();
    let mut stdin = BufReader::new(stdin.lock());
    let stdout = io::stdout();
    let mut stdout = BufWriter::new(stdout.lock());

    let mut buf = String::new();
    stdin.read_to_string(&mut buf).unwrap();

    let sum: u32 = buf
        .bytes()
        .filter(|b| b.is_ascii_digit())
        .map(|b| b as u32 - 48)
        .sum();
    writeln!(&mut stdout, "{}", sum).unwrap();
}
0