提交时间:2022-10-15 11:25:58
运行 ID: 60332
#include <bits/stdc++.h> #define int long long using namespace std; int a[101010]; const int mod = 1e9+7; signed main(){ // freopen("J3.in","r",stdin); // freopen("J3.out","w",stdout); int n,sum = 0; cin>>n; for (int i=1;i<=n;i++){ cin>>a[i]; sum = (sum+(a[i]*i)%mod*(n-i+1))%mod; } cout<<sum<<endl; return 0; }