标签:style blog http io color ar os for sp
http://acm.hdu.edu.cn/showproblem.php?pid=5086
#include <iostream> #include <stdio.h> #include <math.h> #include <queue> #include <map> #include <stdlib.h> #include <algorithm> #include <string.h> #define mod 1000000007 using namespace std; int n; __int64 a[447010]; __int64 sum; int main() { int T; scanf("%d",&T); while(T--) { sum=0; scanf("%d",&n); a[0]=0; for(int i=1; i<=n; i++) { scanf("%I64d",&a[i]); } if(n==1) { printf("%I64d\n",a[1]); continue; } else { for(int i=1; i<=n; i++) { sum=(sum+a[i]*i%mod*(n-i+1)%mod)%mod; } } printf("%I64d\n",sum); } return 0; }
HDU5086:Revenge of Segment Tree(规律题)
标签:style blog http io color ar os for sp
原文地址:http://www.cnblogs.com/zhangmingcheng/p/4069805.html