https://atcoder.jp/contests/math-and-algorithm/tasks/arc107_a
ですね。
// Simple Math #![allow(non_snake_case)] //////////////////// constants //////////////////// const D: u64 = 998244353; //////////////////// 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 read_input() -> (u64, u64, u64) { let v = read_vec(); let A = v[0]; let B = v[1]; let C = v[2]; (A, B, C) } fn T(N: u64) -> u64 { if N % 2 == 0 { (N / 2) * (N + 1) % D } else { N * ((N + 1) / 2) % D } } fn f(A: u64, B: u64, C: u64) -> u64 { T(A) * T(B) % D * T(C) % D } fn main() { let (A, B, C) = read_input(); println!("{}", f(A, B, C)) }