結果
| 問題 |
No.987 N×Mマス計算(基本)
|
| コンテスト | |
| ユーザー |
knohkw
|
| 提出日時 | 2022-04-27 11:55:38 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 947 bytes |
| コンパイル時間 | 20,859 ms |
| コンパイル使用メモリ | 379,068 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 07:44:06 |
| 合計ジャッジ時間 | 14,493 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 9 WA * 9 |
コンパイルメッセージ
warning: unreachable pattern
--> src/main.rs:28:9
|
18 | plus => {
| ---- matches any value
...
28 | _ => {
| ^ unreachable pattern
|
= note: `#[warn(unreachable_patterns)]` on by default
warning: unused variable: `plus`
--> src/main.rs:16:9
|
16 | let plus = String::from("+");
| ^^^^ help: if this is intentional, prefix it with an underscore: `_plus`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `plus`
--> src/main.rs:18:9
|
18 | plus => {
| ^^^^ help: if this is intentional, prefix it with an underscore: `_plus`
warning: variable `N` should have a snake case name
--> src/main.rs:5:9
|
5 | N: usize,
| ^ help: convert the identifier to snake case: `n`
|
= note: `#[warn(non_snake_case)]` on by default
warning: variable `M` should have a snake case name
--> src/main.rs:6:9
|
6 | M: usize,
| ^ help: convert the identifier to snake case: `m`
warning: variable `A` should have a snake case name
--> src/main.rs:8:9
|
8 | A: [i64; N],
| ^ help: convert the identifier to snake case: `a`
warning: variable `B` should have a snake case name
--> src/main.rs:12:9
|
12 | let B: Vec<i64> = header.into_iter()
| ^ help: convert the identifier to snake case: `b`
ソースコード
use proconio::input;
fn main() {
input! {
N: usize,
M: usize,
mut header: [String; M + 1],
A: [i64; N],
}
let op = header.remove(0);
let B: Vec<i64> = header.into_iter()
.map(|s| s.parse().unwrap())
.collect();
let plus = String::from("+");
match op {
plus => {
for i in 0..N {
let a = A[i];
let row: Vec<String> = B.iter()
.map(|b| (a + b).to_string())
.collect();
let row = row.join(" ");
println!("{}", row)
}
},
_ => {
for i in 0..N {
let a = A[i];
let row: Vec<String> = B.iter()
.map(|b| (a * b).to_string())
.collect();
let row = row.join(" ");
println!("{}", row)
}
}
}
}
knohkw