//2019-02盛水最多
#include <iostream>
using namespace std;
const int N = 10010;
int a[N];
int res = 0;
int x, y;
int main()
{
int n;
cin >> n;
getchar();
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1, j = n; i < j;)
{
int h = min(a[i], a[j]);
int m = (j - i) * h;
if (m > res)
{
res = m;
x = i; y = j;
}
if (a[i] > a[j])
j--;
else
i++;
}
cout << res << endl;
}
hdu笔试2019-02盛水最多
![](https://img-home.csdnimg.cn/images/20240711042549.png)