HDU5086:Revenge of Segment Tree(规律题)
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(规律题)的更多相关文章
- hdu5086——Revenge of Segment Tree
Revenge of Segment Tree Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/ ...
- HDU5086——Revenge of Segment Tree(BestCoder Round #16)
Revenge of Segment Tree Problem DescriptionIn computer science, a segment tree is a tree data struct ...
- hdu 5086 Revenge of Segment Tree(BestCoder Round #16)
Revenge of Segment Tree Time Limit: 4000/20 ...
- [ACM] HDU 5086 Revenge of Segment Tree(全部连续区间的和)
Revenge of Segment Tree Problem Description In computer science, a segment tree is a tree data struc ...
- HUD 5086 Revenge of Segment Tree(递推)
http://acm.hdu.edu.cn/showproblem.php?pid=5086 题目大意: 给定一个序列,求这个序列的子序列的和,再求所有子序列总和,这些子序列是连续的.去题目给的第二组 ...
- BestCoder#16 A-Revenge of Segment Tree
Revenge of Segment Tree Problem Description In computer science, a segment tree is a tree data struc ...
- Segment Tree Build I & II
Segment Tree Build I The structure of Segment Tree is a binary tree which each node has two attribut ...
- SPOJ 11840. Sum of Squares with Segment Tree (线段树,区间更新)
http://www.spoj.com/problems/SEGSQRSS/ SPOJ Problem Set (classical) 11840. Sum of Squares with Segme ...
- HDURevenge of Segment Tree(第二长的递增子序列)
HDURevenge of Segment Tree(第二长的递增子序列) 题目链接 题目大意:这题是求第二长的递增子序列. 解题思路:用n^2的算法来求LIS,可是这里还要记录一下最长的那个序列是否 ...
随机推荐
- php 在windows下配置虚拟目录的方法
1.先找到apache的配置文件 httpd.conf 找如如下代码: # Virtual hosts#Include conf/extra/httpd-vhosts.conf 把# Include ...
- 静态变量数组实现LRU算法
LRU算法的解释详情请见 https://baike.baidu.com/item/LRU/1269842 这里百度百科给出的比较详细,然后后面有一个例子 说 LRU(least recently u ...
- hive与hbase的联系与区别
hive与hbase的联系与区别: 共同点: 1.hbase与hive都是架构在hadoop之上的.都是用hadoop作为底层存储. 他们的底层是要通过mapreduce分布式计算的,hbase.hi ...
- Linux 文件基本属性(转)
Linux 文件基本属性 Linux系统是一种典型的多用户系统,不同的用户处于不同的地位,拥有不同的权限.为了保护系统的安全性,Linux系统对不同的用户访问同一文件(包括目录文件)的权限做了不同的规 ...
- poj_1151 线段树
题目大意 在平面上给定n个矩形,可以相互覆盖全部或者部分,求出矩形占据的总面积. 题目分析 将矩形按照x方向的进行分割之后,将平面沿着y方向划分一系列单元(不定高度),每个矩形在y方向上占据若干连续的 ...
- 网络电话pjsip Getting Started: Building for Apple iPhone, iPad and iPod Touch
Getting Started: Building for Apple iPhone, iPad and iPod Touch ¶ Getting Started Preparation Get th ...
- 【python系列】SyntaxError:Missing parentheses in call to 'print'
打印python2和python3的区别 如上图所示,我的 PyCharm安装的是python3.6如果使用print 10会出现语法错误,这是python2.x和python3.x的区别所导致的.
- chrome inspect 离线调试-工具包 怎么使用
1.找到相关目录: C:\Users\当前用户\AppData\Local\Google\Chrome\User Data\Default 2.找到以下文件夹: 1.Application Cache ...
- Java多线程(4)----线程的四种状态
与人有生老病死一样,线程也同样要经历开始(等待).运行.挂起和停止四种不同的状态.这四种状态都可以通过Thread类中的方法进行控制.下面给出了Thread类中和这四种状态相关的方法. 1 // 开始 ...
- mysql查看线程详解(转载)
如果有 SUPER 权限,则可以看到全部的线程,否则,只能看到自己发起的线程(这是指,当前对应的 MySQL 帐户运行的线程). mysql> show processlist; +—–+——— ...