B - AtCoder Condominium Editorial by lucifer1004
Under the given constraints, the answer can be expressed as:
\[ \dfrac{n(n+1)}{2}\cdot k\cdot100+\dfrac{k(k+1)}{2}\cdot n \]
- Time complexity is \(\mathcal{O}(1)\).
- Space complexity is \(\mathcal{O}(1)\).
use proconio::input;
fn main() {
input! {
n: usize,
k: usize,
}
println!("{}", n * (n + 1) / 2 * k * 100 + k * (k + 1) / 2 * n);
}
posted:
last update: