結果

問題 No.509 塗りつぶしツール
コンテスト
ユーザー packet0
提出日時 2017-04-29 22:58:37
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 376 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,343 ms
コンパイル使用メモリ 185,160 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-04 07:15:33
合計ジャッジ時間 5,006 ms
ジャッジサーバーID
(参考情報)
judge5_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused `Result` that must be used
 --> src/main.rs:7:5
  |
7 |     std::io::stdin().read_line(&mut line);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this `Result` may be an `Err` variant, which should be handled
  = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default
help: use `let _ = ...` to ignore the resulting value
  |
7 |     let _ = std::io::stdin().read_line(&mut line);
  |     +++++++

ソースコード

diff #
raw source code

const HOLES: [usize; 10] = [1, 0, 0, 0, 1, 0, 1, 0, 2, 1];
const ZERO: usize = '0' as usize;

fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line);

    let (mut count, mut extra) = (0, 0);

    for c in line.trim().chars() {
        count += 1;
        extra += HOLES[c as usize - ZERO];
    }

    println!("{}", 2 * count + extra + 1);
}
0