結果
| 問題 |
No.988 N×Mマス計算(総和)
|
| コンテスト | |
| ユーザー |
ixTL255
|
| 提出日時 | 2023-01-03 12:26:48 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 960 bytes |
| コンパイル時間 | 11,400 ms |
| コンパイル使用メモリ | 380,724 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2024-11-27 01:49:38 |
| 合計ジャッジ時間 | 12,894 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 9 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/main.rs:20:9 | 20 | 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 k: 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();
let asum: usize = a.iter().sum();
let bsum: usize = b.iter().sum();
if op == '+' { println!("{}", (m * asum + n * bsum) % k ); }
else { println!("{}", (asum * bsum) % k ); }
}
ixTL255