結果

問題 No.1070 Missing a space
ユーザー seinyan
提出日時 2021-11-07 23:21:11
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 443 bytes
コンパイル時間 14,309 ms
コンパイル使用メモリ 394,948 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-15 01:55:15
合計ジャッジ時間 14,362 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let v: Vec<char> = input_line::<String>()[0].chars().collect();
    let mut ans = 0;
    for ch in &v[1..] {
        if *ch != '0' {
            ans += 1;
        }
    }
    print!("{}", ans);
}

fn input_line<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
0