标签:des blog http io ar os java for sp
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 845 Accepted Submission(s): 302
#include<cstdio> #include<iostream> #define mod 1000000007 using namespace std; __int64 a[500000]; __int64 sum; int main() { __int64 i,j,n; int t; scanf("%d",&t); while(t--) { scanf("%I64d",&n); sum=0; for(i=1;i<=n;i++) { scanf("%I64d",&a[i]); sum+=a[i]*(i * (n - i + 1)%mod);// 主要注意这里会超long long 所以要在内部取余 sum%=mod; } printf("%I64d\n",sum); } return 0; }
hdu 5086 Revenge of Segment Tree
标签:des blog http io ar os java for sp
原文地址:http://www.cnblogs.com/sola1994/p/4072170.html