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. ASP.NET的用户控件

    本文介绍如何在ASP.NET中创建用户控件,控件属性的动态修改以及控件的事件出发机制. 简介ASP.NET的服务端控件使得Web开发工作变得更为简单,功能更为强大.我们介绍过如何在ASP.NET页面中 ...

  2. C/C++ 控制台演示彩色输出进度

    #include <stdio.h> #include <windows.h> BOOL SetConsoleColor(WORD wAttributes); int main ...

  3. javascript与 ios通讯解决办法

    阔别1年半之久,一个JavaScript和ios通讯的想法终于被实现了(我不知道别人有没有早就实现过~). 记得早期ios内嵌html做通讯时,貌似做好的办法只能是 ios通过url来截取页面发送消息 ...

  4. schema in oracle

    the conception of schema is different in different db software. here i just refer to oracle schema. ...

  5. BEGINNING SHAREPOINT&#174; 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 WOPI和新的Office Web Apps Server

    BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序  WOPI和新的Office Web Apps Server ...

  6. NUC131的系统管理

    系统复位系统复位可以由如下的任何一种中断实现,这些复位中断标志可以通过寄存器RSTSRC读取. 上电复位 nRESET引脚低电平复位 看门狗复位 低压复位 欠压检测器复位 CPU 复位 ...

  7. 关于ARM的内核架构

    很多时候我们都会对M0,M0+,M3,M4,M7,arm7,arm9,CORTEX-A系列,或者说AVR,51,PIC等,一头雾水,只知道是架构,不知道具体是什么,有哪些不同?今天查了些资料,来解解惑 ...

  8. PyQt4状态栏

    主窗口 QMainWindow类用来创建应用程序的主窗口.通过该类,我们可以创建一个包含状态栏.工具栏和菜单栏的经典应用程序框架. 状态栏是用来显示状态信息的串口部件. #!/usr/bin/pyth ...

  9. PyQt4开关按钮ToggleButton

    PyQt4没有开关按钮部件.但是我们可以使用在特殊状态下的QPushButton部件来创建开关按钮.而所谓的开关按钮就是一个具有按下和未按下两种状态的普通赶牛.用户可以通过单击按钮来切换其开或者关的状 ...

  10. Oracle12c Release1安装图解(详解)

    工具/原料   Windows系统平台 Oracle12cR1数据库软件 方法/步骤   1 我的机器基础环境:Windows8(x64) + Oracle11g Release2(x64): 初次全 ...