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 = 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 = 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 = B.iter() .map(|b| (a * b).to_string()) .collect(); let row = row.join(" "); println!("{}", row) } } } }