結果

問題 No.656 ゴルフ
ユーザー pekempeypekempey
提出日時 2018-03-02 22:23:30
言語 Rust
(1.72.1)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 3,685 ms
コンパイル使用メモリ 133,896 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 22:32:04
合計ジャッジ時間 4,489 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
  let s: String = input();
  let ans = s.chars().map(|x| x.to_digit(10).unwrap()).fold(0, |x, y| if y == 0 { x + 10 } else { x + y });
  println!("{}", ans);
}

fn input<T: std::str::FromStr>() -> T {
  use std::io::Read;
  let stdin = std::io::stdin();
  let stdin = stdin.bytes();
  let token = stdin
    .skip_while(|x| (*x.as_ref().unwrap() as char).is_whitespace())
    .take_while(|x| !(*x.as_ref().unwrap() as char).is_whitespace())
    .map(|x| x.unwrap())
    .collect();
  let token = String::from_utf8(token).unwrap();
  match token.parse() {
    Ok(x) => x,
    Err(_) => panic!("{}", token),
  }
}
0