Banner Home Page DIY Contests Problems Ranklist Status Statistics

毛线数列最值

Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 67   Accepted Submission(s) : 20

Font: Times New Roman | Verdana | Georgia

Font Size:

Problem Description

halfyarn找你写个简单的题?好哒!给你n个整数,现在要求你选择两个位置的数,例如选择第pos_a个数a,和第pos_b个数b,给定ans=min(a,b)*abs(pos_a-pos_b),输出ans的最大值。

Input

第一行输入一个n代表有n个数,接下来的一行输入n个整数;
2<=n<=1e6;
1<=a,b<=1e6;
注意多组输入;

Output

ans的最大值;

Sample Input

4
1 2 2 2

Sample Output

4

Author

zhengjinke2123

Statistic | Submit | Back