#include<algorithm>
using namespace std;
bool cmp(long long n,long long m)
{
return n>m;
}
int main()
{
int n=0,i=0,j=0;
cin>>n;
int *h=new int [n];
long long *s=new long long [n];
for(int i=0;i<n;i++)
{
cin>>h[i];
}
for(i=0;i<n;i++) //找每个柱形的连续相同高度个数,并求出每次的面积
{
int count=1;
for(j=i+1;j<n;j++) //正向进行
{
if(h[i]>h[j])
{
break;
}
if(h[i]<=h[j])
{
count++;
}
}
for(j=i-1;j>=0;j--) //反向进行
{
if(h[i]>h[j])
{
break;
}
if(h[i]<=h[j])
{
count++;
}
}
s[i]=h[i]*count;
}
sort(s,s+n,cmp);
cout<<s[0]<<endl;
delete []h;
delete []s;
return 0;
}
04-17
09-02
1293
08-31
1909