题目:2875. 超级胶水
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+10;
int w[N];
int main(){
int n;
scanf("%d",&n);
LL sum=0,ans=0;
for(int i=1;i<=n;i++){
scanf("%d",&w[i]);
ans+=sum*w[i];
sum+=w[i];
}
printf("%lld",ans);
return 0;
}