結果
| 問題 | No.987 N×Mマス計算(基本) |
| コンテスト | |
| ユーザー |
ixTL255
|
| 提出日時 | 2023-01-03 11:19:40 |
| 言語 | Rust (1.99.0 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 469µs | |
| コード長 | 1,072 bytes |
| 記録 | |
| コンパイル時間 | 910 ms |
| コンパイル使用メモリ | 194,896 KB |
| 実行使用メモリ | 9,868 KB |
| 最終ジャッジ日時 | 2026-09-30 14:41:10 |
| 合計ジャッジ時間 | 3,620 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/main.rs:19:9 | 19 | let mut a = a.trim().split_whitespace(); | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default warning: unused variable: `n` --> src/main.rs:8:9 | 8 | let n: usize = s.next().unwrap().parse().unwrap(); | ^ help: if this is intentional, prefix it with an underscore: `_n` | = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default warning: unused variable: `m` --> src/main.rs:9:9 | 9 | let m: usize = s.next().unwrap().parse().unwrap(); | ^ help: if this is intentional, prefix it with an underscore: `_m`
ソースコード
use std::io;
use std::io::Read;
fn main() {
let mut s = String::new();
io::stdin().read_line(&mut s).ok();
let mut s = s.trim().split_whitespace();
let n: usize = s.next().unwrap().parse().unwrap();
let m: usize = s.next().unwrap().parse().unwrap();
let mut b = String::new();
io::stdin().read_line(&mut b).ok();
let mut b = b.trim().split_whitespace();
let op: char = b.next().unwrap().chars().nth(0).unwrap();
let b: Vec<usize> = b.map(|e| e.parse().unwrap()).collect();
let mut a = String::new();
std::io::stdin().read_to_string(&mut a).ok();
let mut a = a.trim().split_whitespace();
let a: Vec<usize> = a.map(|e| e.parse().unwrap()).collect();
for i in 0..a.len() {
let mut tmp = Vec::<usize>::new();
for j in 0..b.len() {
if op == '+' {
tmp.push(a[i] + b[j]);
} else {
tmp.push(a[i] * b[j]);
}
}
println!("{}", tmp.iter().map(|e| e.to_string())
.collect::<Vec<String>>().join(" "));
}
}
ixTL255