hdu_1003_Max Sum
Max Sum
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 142281 Accepted Submission(s): 33104
#include<iostream>
using namespace std;
int main()
{
int t,len,m=,h,n,w,l,r,p,e,i;
cin>>t;h=t;
while(t--)
{
m++;
l=r=p=e=;
cin>>len;
int a[len];
for(i=;i<len;i++)
cin>>a[i];
n=a[],w=a[];l=;p=;
for(i=;i<len;i++)
{
if(a[i]>n+a[i]){
n=a[i];
l=i;
r=i;
}
else {
n=n+a[i];
r=i;
}
if(n>w){
w=n;
e=r;
p=l;
}
}
cout<<"Case "<<m<<":"<<endl<<w<<" "<<p+<<" "<<e+<<endl;
if(m!=h)cout<<endl;
}
return ;
}
hdu_1003_Max Sum的更多相关文章
- LeetCode - Two Sum
Two Sum 題目連結 官網題目說明: 解法: 從給定的一組值內找出第一組兩數相加剛好等於給定的目標值,暴力解很簡單(只會這樣= =),兩個迴圈,只要找到相加的值就跳出. /// <summa ...
- Leetcode 笔记 113 - Path Sum II
题目链接:Path Sum II | LeetCode OJ Given a binary tree and a sum, find all root-to-leaf paths where each ...
- Leetcode 笔记 112 - Path Sum
题目链接:Path Sum | LeetCode OJ Given a binary tree and a sum, determine if the tree has a root-to-leaf ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- BZOJ 3944 Sum
题目链接:Sum 嗯--不要在意--我发这篇博客只是为了保存一下杜教筛的板子的-- 你说你不会杜教筛?有一篇博客写的很好,看完应该就会了-- 这道题就是杜教筛板子题,也没什么好讲的-- 下面贴代码(不 ...
- [LeetCode] Path Sum III 二叉树的路径和之三
You are given a binary tree in which each node contains an integer value. Find the number of paths t ...
- [LeetCode] Partition Equal Subset Sum 相同子集和分割
Given a non-empty array containing only positive integers, find if the array can be partitioned into ...
- [LeetCode] Split Array Largest Sum 分割数组的最大值
Given an array which consists of non-negative integers and an integer m, you can split the array int ...
- [LeetCode] Sum of Left Leaves 左子叶之和
Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two l ...
随机推荐
- 嵌入式linux平台搭建
选用Ubuntu12.04.2系统搭建平台.在原始系统下做如下更改: 将更新使用的服务器设置为国内“163”服务器 安装SSH,uboot—mkimage等软件 安装编译器“arm—2009q3”及相 ...
- 虚拟机之仅主机模式(HostOnly)链接外网设置
我的环境: 虚拟机-VMware 虚拟系统-CentOS 现实主机-win7 具体设置步骤: 一.设置现实主机 (地址等不用额外设置,下面是我电脑正常上网的配置) 将本地链接设置共享(这步很重要) 二 ...
- hug and Compression Resistance
Hugging => content does not want to grow Compression Resistance => content does not want to sh ...
- 17 Great Machine Learning Libraries
17 Great Machine Learning Libraries 08 October 2013 After wonderful feedback on my previous post on ...
- oracle删除当前用户下所有表
1.如果有删除用户的权限,则可以: drop user user_name cascade; 加了cascade就可以把用户连带的数据全部删掉. 删除后再创建该用户.--创建管理员用户create u ...
- 借助 AOP 为 Java Web 应用记录性能数据
作为开发者,应用的性能始终是我们最感兴趣的话题之一.然而,不是所有的开发者都对自己维护的应用的性能有所了解,更别说快速定位性能瓶颈并实施解决方案了. 今年北京 Velocity 的赞助商大多从事 AP ...
- zoj 3878 Convert QWERTY to Dvorak【好坑的模拟】
Convert QWERTY to Dvorak Time Limit: 2 Seconds Memory Limit: 65536 KB Edward, a poor copy typis ...
- MSSQLSERVER数据库- 打开表出现目录名无效
打开SQLSERVER数据库,出现目录名无效,如下图: 解决方法到 临时目录:C:\Documents and Settings\Administrator\Local Settings\Temp 手 ...
- SSH开源框架考试题
一.选择题 1.不属于Action接口中定义的字符串常量的是____B___. A.SUCCESS B.FAILURE C.ERROR ...
- Codeforces Round #198 (Div. 2) D. Bubble Sort Graph (转化为最长非降子序列)
D. Bubble Sort Graph time limit per test 1 second memory limit per test 256 megabytes input standard ...