python……
t=eval(input()) for i in range(t): n=eval(input()) a=[0] b=list(map(eval,input().split())) for j in b: a.append(j) sum,isum,risum=0,0,0 ans=123456789000000000 for j in range(1,n+1): sum+=a[j] isum+=j*a[j] risum+=(n-j+1)*a[j] for j in range(n,1,-1): isum+=sum-n*a[j] ans=min(ans,isum) for j in range(1,n+1): risum+=sum-n*a[j] ans=min(ans,risum) print(ans)python被针对了?按题解的算法,A题超时C题说暴力模拟就行,结果python也是超时????#学习路径#