結果
| 問題 |
No.987 N×Mマス計算(基本)
|
| コンテスト | |
| ユーザー |
ixTL255
|
| 提出日時 | 2023-01-03 11:19:40 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,072 bytes |
| コンパイル時間 | 11,430 ms |
| コンパイル使用メモリ | 391,724 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 01:48:09 |
| 合計ジャッジ時間 | 12,692 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
コンパイルメッセージ
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)]` 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` 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)]` on by default
ソースコード
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