結果

問題 No.656 ゴルフ
ユーザー pekempey
提出日時 2018-03-02 22:23:30
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 27,715 ms
コンパイル使用メモリ 392,808 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-13 03:09:46
合計ジャッジ時間 14,888 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

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