提交时间:2024-08-20 09:04:06

运行 ID: 168261

#include<bits/stdc++.h> using namespace std; int n, x, cnt, sum; int main(){ cin>>n; if(n < 3){ cout<<0<<endl; return 0; } for(int i = 1;i <= n-2;i++) cnt += i; for(int i = 1;i <= n;i++){ cin>>x; sum += cnt*x; } cout<<sum<<endl; }