complete 2921.rs
This commit is contained in:
14
storage/zeta/rs/completed/2921.rs
Normal file
14
storage/zeta/rs/completed/2921.rs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
use std::io::{read_to_string, stdin};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let temp = read_to_string(stdin()).unwrap();
|
||||||
|
let mut iter = temp
|
||||||
|
.split_ascii_whitespace()
|
||||||
|
.map(|x| x.parse::<usize>().unwrap());
|
||||||
|
let n = iter.next().unwrap();
|
||||||
|
let mut s = 0;
|
||||||
|
for i in 1..=n {
|
||||||
|
s += 3 * (i + 1) * i / 2;
|
||||||
|
}
|
||||||
|
println!("{}", s);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user