标签:des blog ar io os sp for java strong
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1175 Accepted Submission(s): 403
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<cstdlib> #include<algorithm> #include<queue> #include<set> #include<vector> using namespace std; const long long MOD=1e9+7; #define LL long long LL a[447005],ans; int t,n; int main() { scanf("%d",&t); while(t--) { ans=0; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%lld",&a[i]); for(int i=1;i<=n;i++) { ans=(ans+(a[i]*i)%MOD*(n-i+1))%MOD; } printf("%lld\n",ans); } return 0; }
标签:des blog ar io os sp for java strong
原文地址:http://www.cnblogs.com/a972290869/p/4170861.html