結果
| 問題 | No.289 数字を全て足そう | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-04-23 23:06:39 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 1,000 ms | 
| コード長 | 415 bytes | 
| コンパイル時間 | 12,572 ms | 
| コンパイル使用メモリ | 402,292 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-06 08:02:58 | 
| 合計ジャッジ時間 | 13,914 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
use std::io::{self, BufRead};
fn get_lines() -> Vec<String> {
    let stdin = io::stdin();
    let lines: Vec<String> = stdin.lock().lines().map(|l| l.unwrap()).collect();
    return lines;
}
fn main(){
	let s = &get_lines()[0];
    let mut sum = 0;
    for c in s.chars() {
        if c.is_digit(10) {
            let n = c.to_digit(10).unwrap();
            sum += n;
        }
    }
    println!("{}", sum);
}
            
            
            
        