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[];
__int64 sum;
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
sum=;
scanf("%d",&n);
a[]=;
for(int i=; i<=n; i++)
{
scanf("%I64d",&a[i]);
}
if(n==)
{
printf("%I64d\n",a[]);
continue;
}
else
{
for(int i=; i<=n; i++)
{
sum=(sum+a[i]*i%mod*(n-i+)%mod)%mod;
}
}
printf("%I64d\n",sum);
}
return ;
}

HDU5086:Revenge of Segment Tree(规律题)的更多相关文章

  1. hdu5086——Revenge of Segment Tree

    Revenge of Segment Tree Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/ ...

  2. HDU5086——Revenge of Segment Tree(BestCoder Round #16)

    Revenge of Segment Tree Problem DescriptionIn computer science, a segment tree is a tree data struct ...

  3. hdu 5086 Revenge of Segment Tree(BestCoder Round #16)

    Revenge of Segment Tree                                                          Time Limit: 4000/20 ...

  4. [ACM] HDU 5086 Revenge of Segment Tree(全部连续区间的和)

    Revenge of Segment Tree Problem Description In computer science, a segment tree is a tree data struc ...

  5. HUD 5086 Revenge of Segment Tree(递推)

    http://acm.hdu.edu.cn/showproblem.php?pid=5086 题目大意: 给定一个序列,求这个序列的子序列的和,再求所有子序列总和,这些子序列是连续的.去题目给的第二组 ...

  6. BestCoder#16 A-Revenge of Segment Tree

    Revenge of Segment Tree Problem Description In computer science, a segment tree is a tree data struc ...

  7. Segment Tree Build I & II

    Segment Tree Build I The structure of Segment Tree is a binary tree which each node has two attribut ...

  8. SPOJ 11840. Sum of Squares with Segment Tree (线段树,区间更新)

    http://www.spoj.com/problems/SEGSQRSS/ SPOJ Problem Set (classical) 11840. Sum of Squares with Segme ...

  9. HDURevenge of Segment Tree(第二长的递增子序列)

    HDURevenge of Segment Tree(第二长的递增子序列) 题目链接 题目大意:这题是求第二长的递增子序列. 解题思路:用n^2的算法来求LIS,可是这里还要记录一下最长的那个序列是否 ...

随机推荐

  1. MySQL Server 5.7.13

    如何安装MySQL,MySQL两种安装方式_百度经验 http://jingyan.baidu.com/article/cd4c2979033a17756f6e6047.html "C:\P ...

  2. mongodb启动时报错ERROR: child process failed, exited with error number 1

    不多说,直接上干货! 前期博客 Ubuntu14.04下Mongodb安装部署步骤(图文详解) Ubuntu16.04下Mongodb安装部署步骤(图文详解) root@zhouls-virtual- ...

  3. wm_concat函数 用法

    首先让我们来看看这个神奇的函数wm_concat(列名),该函数可以把列值以","号分隔起来,并显示成一行,接下来上例子,看看这个神奇的函数如何应用 准备测试数据 SQL>  ...

  4. Strut2------获取界面返回的session,application,parameter

    1.Action类下的代码 public class ServletActionDemo extends ActionSupport { @Override public String execute ...

  5. 第一篇:《UNIX 网络编程 第二版》编译环境的搭建

    第一步:搭建基本的编译环境 安装gcc, g++, bulid-essential等编译软件 第二步:下载本书示例源码包 第三步:解压下载到的包并放在用户主目录中 第四步:进入包内并执行以下命令 su ...

  6. nutch爬取时Exception in thread “main” java.io.IOException: Job failed!

    用cygwin运行nutch 1.2爬取提示IOException: $ bin/nutch crawl urls -dir crawl -depth 3 -topN 10 crawl started ...

  7. piblog 0.2

    在一个Web App中,所有的数据,包括用户的信息,日志,评论等,都存在数据库中.在piblog中使用MySQL作为数据库.Web App中由很多地方需要使用数据库.访问数据库需要创建数据库连接.游标 ...

  8. js中replace()方法

    str.replace(/Microsoft/g, "W3School");//全局替换 str.replace(/Microsoft/, "W3School" ...

  9. 本地schemeApp扩展

    作者:ani_di 版权所有,转载务必保留此链接 http://blog.csdn.net/ani_di 本地schemeApp扩展 iHasApp这个用过的话,大概知道我说的是什么了. scheme ...

  10. redis基础----->redis的基本使用(一)

    这里我们就在虚拟机中安装redis,并且使用java和python实现简单的操作.深情是我承担不起的重担,情话只是偶尔兑现的谎言. redis的使用 下载地址:https://redis.io/.安装 ...