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,可是这里还要记录一下最长的那个序列是否 ...
随机推荐
- 换个思路理解Javascript中的this
https://segmentfault.com/a/1190000010328752
- 工作流JBPM_day01:3-使用JBPM的API添加与执行流程
工作流JBPM_day01:3-使用JBPM的API添加与执行流程 流程定义画完得到压缩文件--->部署流程定义-->启动流程实例-->查询我的个人任务列表-->办理任务--& ...
- python2.0_s12_day11_SqlAlchemy使用介绍
SqlAlchemy ORM ORM的解释; 简单点:对象关系映射. 需求:我们写一个主机管理,把主机信息存在数据库,一开始我们编程不熟练的时候,执行命令时候要调用数据库,会把相应的SQL语句写到代码 ...
- kafka原理
今天因为工作接触kafka,先说说kafka是干嘛的. kafka: 说简单点他就是一个基于分布式的消息发布-订阅系统. 然后再理解一些专有名词: Kafka 专用术语 Broker:Kafka 集群 ...
- 将Eclipse项目导入到Android studio 中 很多点9图出现问题解决方法
在build.gradle里添加以下两句: aaptOptions.cruncherEnabled = false aaptOptions.useNewCruncher = false
- EventBus 简单原理(一)
EventBus 1.根据文章最前面所讲的EventBus使用步骤,首先我们需要定义一个消息事件类: public class MessageEvent { private String messag ...
- PyQt4将窗口放在屏幕中间
以下脚本显示了将窗口放在屏幕中间位置的方法. #!/usr/bin/python # -*- coding:utf-8 -*- import sys from PyQt4 import QtGui c ...
- 浅谈MVC和MVVM模式
MVC I’m dating with a model… and a view, and a controller. 众所周知,MVC 是开发客户端最经典的设计模式,iOS 开发也不例外,但是 MVC ...
- 旅游吧!我在这里 ——旅游相册POI搜索:找回你的足迹
版权声明:本文由林少彬原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/89 来源:腾云阁 https://www.qclou ...
- office2010如何使用excel冻结窗格
当我们在制作一个Excel表格时,如果列数较多,行数也较多时,一旦向下滚屏,则上面的标题行也跟着滚动,在处理数据时往往难以分清各列数据对应的标题,事实上利用"冻结窗格"功能可以很好 ...