https://atcoder.jp/contests/math-and-algorithm/tasks/math_and_algorithm_d
整数を3つではなく一般化しました。積にsumのようなものはないですが、foldが使えますね。
// Product of 3 Integers #![allow(non_snake_case)] //////////////////// library //////////////////// fn read<T: std::str::FromStr>() -> T { let mut line = String::new(); std::io::stdin().read_line(&mut line).ok(); line.trim().parse().ok().unwrap() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { read::<String>().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() } //////////////////// process //////////////////// fn f(A: Vec<i32>) -> i32 { A.iter().fold(1, |x, y| x * y) } fn main() { let A: Vec<i32> = read_vec(); println!("{}", f(A)) }