-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol.cpp
More file actions
executable file
·42 lines (30 loc) · 803 Bytes
/
Copy pathsol.cpp
File metadata and controls
executable file
·42 lines (30 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <bits/stdc++.h>
using namespace std;
double calculateScore(vector<double> V, int skip)
{
double score = 0.0;
int offset = 0;
for (int i = 0; i < V.size(); ++i)
if (i != skip)
score += 0.2 * V[i] * pow(0.8, i - offset);
else
++offset;
return score;
}
int main()
{
fixed(cout);
cout.precision(10);
int n;
cin >> n;
vector<double> V(n);
for (int i = 0; i < n; ++i)
cin >> V[i];
cout << calculateScore(V, -1) << endl;
vector<double> alt_scores;
for (int i = 0; i < V.size(); ++i)
alt_scores.push_back(calculateScore(V, i));
double new_result = accumulate(alt_scores.begin(), alt_scores.end(), 0.0) / (double)alt_scores.size();
cout << new_result << endl;
return 0;
}