結果

問題 No.1942 Leading zero
ユーザー AzumabashiAzumabashi
提出日時 2022-06-27 00:07:19
言語 Rust
(1.77.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 13,949 ms
コンパイル使用メモリ 377,452 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 20:35:04
合計ジャッジ時間 14,795 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 15 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused `Result` that must be used
 --> src/main.rs:5:5
  |
5 |     io::stdin().read_line(&mut nn);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = 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
  |
5 |     let _ = io::stdin().read_line(&mut nn);
  |     +++++++

warning: unused `Result` that must be used
  --> src/main.rs:12:9
   |
12 |         io::stdin().read_line(&mut mm);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this `Result` may be an `Err` variant, which should be handled
help: use `let _ = ...` to ignore the resulting value
   |
12 |         let _ = io::stdin().read_line(&mut mm);
   |         +++++++

ソースコード

diff #

use std::io;

fn main() {
    let mut nn = String::new();
    io::stdin().read_line(&mut nn);
    let n: i32 = match nn.trim().parse() {
        Ok(num) => num,
        Err(_) => 0
    };
    for _i in 0..n {
        let mut mm = String::new();
        io::stdin().read_line(&mut mm);
        let m: i32 = match mm.trim().parse() {
            Ok(num) => num,
            Err(_) => 0
        };
        println!("{}", m);
    }
}
0