結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
|
提出日時 | 2019-10-13 23:17:17 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 522 bytes |
コンパイル時間 | 12,268 ms |
コンパイル使用メモリ | 404,456 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-17 19:09:13 |
合計ジャッジ時間 | 13,393 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
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 = read_stdin(); println!("{}", &input[0] .chars() .fold(0, |acc, c| { if c.is_digit(10) { acc + c.to_digit(10).unwrap() } else { acc } }) ); }