結果
問題 |
No.988 N×Mマス計算(総和)
|
ユーザー |
|
提出日時 | 2020-06-02 18:47:35 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 931 bytes |
コンパイル時間 | 13,311 ms |
コンパイル使用メモリ | 403,496 KB |
実行使用メモリ | 14,008 KB |
最終ジャッジ日時 | 2024-07-06 07:46:45 |
合計ジャッジ時間 | 17,106 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 4 WA * 6 TLE * 1 -- * 8 |
ソースコード
fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() } fn main() { let input:Vec<usize> = read_vec(); let mut op_with_b:Vec<String> = read_vec(); let op_str = op_with_b.remove(0); let b_s:Vec<i64> = op_with_b.iter().map(|v| v.parse().unwrap()).collect(); let mut ans = 0; if op_str == "+" { for _i in 0..input[0] { let a:i64 = read(); for j in 0..input[1] { ans += a + b_s[j]; } } } else { for _i in 0..input[0] { let a:i64 = read(); for j in 0..input[1] { ans += a * b_s[j]; } } } println!("{}", ans % input[2] as i64); }