結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
![]() |
提出日時 | 2016-10-16 17:53:04 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 403 bytes |
コンパイル時間 | 11,932 ms |
コンパイル使用メモリ | 384,116 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 12:05:07 |
合計ジャッジ時間 | 13,064 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
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() .fold(0, |sum, i| sum+i) } fn main() { let s = getline(); println!("{}", extract_int_sum(s.trim())); }