結果
問題 | No.509 塗りつぶしツール |
ユーザー |
|
提出日時 | 2017-04-29 22:58:37 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 376 bytes |
コンパイル時間 | 12,561 ms |
コンパイル使用メモリ | 383,880 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 19:18:15 |
合計ジャッジ時間 | 13,512 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)]` on by default help: use `let _ = ...` to ignore the resulting value | 7 | let _ = std::io::stdin().read_line(&mut line); | +++++++
ソースコード
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); }