We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5b308ba commit 2908e2bCopy full SHA for 2908e2b
src/abc/abc405c.rs
@@ -0,0 +1,27 @@
1
+/** THIS IS AN OUTPUT FILE. NOT EDIT THIS FILE DIRECTLY. **/
2
+use proconio::input;
3
+use proconio::marker::*;
4
+use std::marker::PhantomData;
5
+use std::cmp::*;
6
+use std::collections::*;
7
+use itertools::Itertools;
8
+
9
10
+fn main() {
11
+ input! {
12
+ n:usize,
13
+ a:[usize;n]
14
+ }
15
16
+ let mut memo = vec![0;n+1];
17
+ for i in (0..n).rev() {
18
+ memo[i] = memo[i+1] + a[i];
19
20
21
+ let mut result = 0usize;
22
+ for i in 0..n-1 {
23
+ result += memo[i+1] * a[i];
24
25
26
+ println!("{}", result);
27
+}
0 commit comments