結果

問題 No.289 数字を全て足そう
コンテスト
ユーザー mottodora
提出日時 2016-10-16 17:51:01
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 368 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,330 ms
コンパイル使用メモリ 185,516 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-16 14:06:16
合計ジャッジ時間 2,512 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn getline() -> String{
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    return ret;
}

fn extract_int_sum(string: &str) -> i32 {
    string.chars().filter(|x| x.is_numeric())
        .map(|x| x.to_string().parse::<i32>().unwrap())
        .sum()
}

fn main() {
    let s = getline();
    println!("{}", extract_int_sum(s.trim()));
}
0