The sum command for MacOS
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

14 行
295B

  1. use std::io::{self, BufRead};
  2. fn main() {
  3. let stdin = io::stdin();
  4. let sum: u32 = stdin
  5. .lock()
  6. .lines()
  7. .map(|line| -> u32 {
  8. let num: u32 = line.unwrap().parse().unwrap_or(0);
  9. num
  10. }).sum();
  11. println!("{}", sum);
  12. }