-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path327-E.cpp
More file actions
40 lines (40 loc) · 719 Bytes
/
327-E.cpp
File metadata and controls
40 lines (40 loc) · 719 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
#include<bits/stdc++.h>
using namespace std;
int n;
double dp[5001][5001];
double a[5001];
double nine[5001];
void init()
{
nine[0]=1;
for(int i=1;i<=n;i++)
{
nine[i]=nine[i-1]*0.9;
}
}
double maxn(double a,double b)
{
if(b-a>(1e-6))return b;
else return a;
}
int main()
{
cin>>n;
init();
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
dp[i][j]=maxn(dp[i-1][j-1]*0.9+a[i],dp[i-1][j]);
}
}
double ans=-1e10;
for(int i=1;i<=n;i++)
{
ans=maxn(dp[n][i]/(10-10*nine[i])-(1200/sqrt(i)),ans);
}
cout<<fixed<<setprecision(15)<<ans<<endl;
system("pause");
return 0;
}