BestCoder Round #16
来源:互联网 发布:linux 给程序root权限 编辑:程序博客网 时间:2024/06/05 18:01
1001 Revenge of Segment Tree
这个题目好像很简单的样子,但是我错了好多次
#include <set>#include <map>#include <queue>#include <stack>#include <math.h>#include <string>#include <vector>#include <stdio.h>#include <stdlib.h>#include <iostream>#include <limits.h>#include <string.h>#include <algorithm>#include <functional>using namespace std;#define maxn 447000+5#define mm 1000000007typedef long long ll;ll a[maxn];ll kk[maxn];int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int t;scanf("%d",&t); while(t--){ ll n;scanf("%I64d",&n); for (int i=1;i<=n;i++){ scanf("%I64d",&a[i]); } kk[1]=n;kk[n]=n; for (ll i=2;i<=n/2;i++){ kk[i]=(kk[i-1]+n-2*(i-1))%mm; kk[n+1-i]=kk[i]; } if (n%2==1){ kk[n/2+1]=(kk[n/2]+1)%mm; } ll ans=0; for (ll i=1;i<=n;i++){ ans=((ans+((kk[i])%mm*(a[i])%mm))%mm)%mm; } printf("%I64d\n",ans); } return 0;}
0 0
- BestCoder Round #16
- 【BestCoder Round #16】
- BestCoder Round #16
- BestCoder Round #16 1001(hdu 5086)
- BestCoder Round #16 1002(hdu 5087)
- hduoj5088 Problem5088 BestCoder Round #16 1003
- BestCoder Round #3 BestCoder Sequence
- bestcoder round #1
- BestCoder round #1
- BestCoder Round #1
- 【索引】BestCoder Round #2
- BestCoder Round #2
- 【索引】BestCoder Round #3
- BestCoder Round #3
- BestCoder Round #3 小记
- BestCoder Round #4 题解
- BestCoder Round #6
- BestCoder Round #8
- Extjs4.2 tooltip 提示宽度问题解决
- 各种进制转换的原理
- c++中的 extern "C"
- Wildcard Matching
- [OSX使用技巧] 【教学】Mac OS X下终端的基本命令 [
- BestCoder Round #16
- 最全的 Web 开发项目检查清单
- 待到樱花漫天时
- [Android 性能优化系列]内存之基础篇--Android如何管理内存
- 韩顺平hibernate session工具类
- 关于Netica
- 谈数学学习
- One day of President
- 重启IIS服务的方法