Skip to content

Commit 328b1dc

Browse files
committed
feat: update 1104
1 parent 51c2a90 commit 328b1dc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

PAT/1104/main.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
int n;
6+
cin >> n;
7+
double sum = 0.0, tmp;
8+
for (int i = 1; i <= n; i++) {
9+
cin >> tmp;
10+
sum += (tmp * i * (n - i + 1));
11+
}
12+
printf("%.2f\n", sum);
13+
return 0;
14+
}

0 commit comments

Comments
 (0)