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,可是这里还要记录一下最长的那个序列是否 ...
随机推荐
- DeDeCMS织梦的采集教程
http://www.tuicool.com/articles/VziaEz dede 第一步.我们打开织梦后台点击采集——采集节点管理——增加新节点 第二步.新增节点-配置网址索引 填写要采集 ...
- C#操作MSMQ(消息队列)
using System; using System.Collections.Generic; using System.Text; using System.Messaging; using Sys ...
- day26<网络编程>
网络编程(网络编程概述) 网络编程(网络编程三要素之IP概述) 网络编程(网络编程三要素之端口号概述) 网络编程(网络编程三要素协议) 网络编程(Socket通信原理图解) 网络编程(UDP传输) 网 ...
- 7 -- Spring的基本用法 -- 3... Spring 的核心机制 : 依赖注入
7.3 Spring 的核心机制 : 依赖注入 Spring 框架的核心功能有两个. Spring容器作为超级大工厂,负责创建.管理所有的Java对象,这些Java对象被称为Bean. Spring容 ...
- 在linux本地下载ftp中的文件
使用wget命令 -r :会在当前目录下生成192.168.30.14文件名 下面的命令就是下载这个ftp目录"/home/ftp/*"下面的所有文件 wget -r ftp:// ...
- MySQL性能优化(七·上)-- 锁机制 之 表锁
前言 数据库的锁主要用来保证数据的一致性的.MyISAM存储引擎只支持表锁,InnoDB存储引擎既支持行锁,也支持表锁,但默认情况下是采用行锁. 一.锁分类 1.按照对数据操作的类型分:读锁,写锁 读 ...
- 管理开机启动:chkconfig
CentOS 6 如何设置服务开机启动: [root@localhost ~]$ ls /etc/init.d/httpd # /etc/init.d/目录下必须有启动脚本 [root@localho ...
- Nginx虚拟主机配置教程
说明:配置之前先把域名解析到服务器IP地址上 站点1:bbs.osyunwei.com 程序所在目录/data/osyunwei/bbs 站点2:sns.osyunwei.com 程序所在目录/d ...
- C++类中的static数据成员,static成员函数
C++类中谈到static,我们可以在类中定义static成员,static成员函数!C++primer里面讲过:static成员它不像普通的数据成员,static数据成员独立于该类的任意对象而存在, ...
- UITextView和UITextField的placeholder,键盘隐藏,键盘换行变完成字样
本文转载至 http://blog.csdn.net/hengshujiyi/article/details/9086093- (void)initFeedBackViews { //设置页面的背景颜 ...