问题链接:https://leetcode.com/problems/rotate-function/
水题
class Solution {
public int maxRotateFunction(int[] A) {
int maxValue=0;
if(A==null || A.length==0)
return maxValue;
for(int i=0;i<A.length;i++)
maxValue += i*A[i];
int tmp=maxValue;
for(int i=1;i<A.length;i++)
{
for(int j=0;j<A.length;j++)
{
if(j==A.length-i)
continue;
tmp += A[j];
}
tmp -= (A.length-1)*A[A.length-i];
maxValue=Math.max(maxValue,tmp);
}
return maxValue;
}
}