| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 911 人关注过本帖
标题:请教源代码
只看楼主 加入收藏
qzt040613
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:63
专家分:0
注 册:2006-3-15
收藏
 问题点数:0 回复次数:7 
请教源代码
北大网站上
http://acm.pku.edu.cn/JudgeOnline/problem?id=2559
2559题


Description
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows the histogram that consists of rectangles with the heights 2, 1, 4, 5, 1, 3, 3, measured in units where 1 is the width of the rectangles:


Usually, histograms are used to represent discrete distributions, e.g., the frequencies of characters in texts. Note that the order of the rectangles, i.e., their heights, is important. Calculate the area of the largest rectangle in a histogram that is aligned at the common base line, too. The figure on the right shows the largest aligned rectangle for the depicted histogram.

Input
The input contains several test cases. Each test case describes a histogram and starts with an integer n, denoting the number of rectangles it is composed of. You may assume that 1<=n<=100000. Then follow n integers h1,...,hn, where 0<=hi<=1000000000. These numbers denote the heights of the rectangles of the histogram in left-to-right order. The width of each rectangle is 1. A zero follows the input for the last test case.

Output
For each test case output on a single line the area of the largest rectangle in the specified histogram. Remember that this rectangle must be aligned at the common base line.

Sample Input

7 2 1 4 5 1 3 3
4 1000 1000 1000 1000
0

Sample Output

8
4000
搜索更多相关主题的帖子: 源代码 北大 histogram acm 
2006-04-20 20:52
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 

你能不能把它先译成中文帖出来?

2006-04-20 20:56
lj_860603
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:714
专家分:0
注 册:2006-1-25
收藏
得分:0 
ACM题目.ACM比赛的题目都是英文.晕.

我的原则很简单:不做不喜欢的事!
2006-04-20 20:59
errorer
Rank: 1
等 级:新手上路
帖 子:38
专家分:0
注 册:2006-4-19
收藏
得分:0 

弄成英文看不懂的呀


思想有多远,就能走多远!
2006-04-20 21:43
feng1256
Rank: 4
等 级:贵宾
威 望:14
帖 子:2899
专家分:0
注 册:2005-11-24
收藏
得分:0 

问题描述

直方图是由一组有着共同基线的长方形序列组成的多边形。这些长方形有相等的宽度但可能有不同的高度。例如:左图是一个直方图,其中各长方形的高度依次为2,1,4,5,1,3,3,测量是以长方形的宽度1为单位。
通常直方图被用来描述一些不连续的概率分布,例如, 字符在文本里出现的频率。请注意这些长方形的顺序,还有它们的高度,都非常重要。现在来计算有共同基线的直方图里最大的长方形区域,右图显示的就是这个直方图里最大的长方形区域。

输入

输入包含几组测试数据。每组数据以整数n开头描述一个由n个长方形组成的直方图。你可以假设
1<=n<=100000. 紧接着的n个整数h1.........hn(0<=hi<=1000000000)依次表示从左到右这些n个长方形的
高度。每个长方形的宽度都为1。0代表结束输入测试数据。

输出

每单独一行输出一组测试中直方图里最大长方形区域的面积.不要忘记这个长方形必须有共同的基线。



叁蓙大山:工謪、稅務、嗣發 抱歉:不回答女人的问题
2006-04-20 22:55
cordier
Rank: 2
等 级:论坛游民
威 望:1
帖 子:449
专家分:14
注 册:2006-2-9
收藏
得分:0 
版主
英语

2006-04-21 06:58
ヤ順祺冄繎ヤ
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:3032
专家分:0
注 册:2005-11-9
收藏
得分:0 
以下是引用feng1256在2006-4-20 22:55:00的发言:

问题描述

直方图是由一组有着共同基线的长方形序列组成的多边形。这些长方形有相等的宽度但可能有不同的高度。例如:左图是一个直方图,其中各长方形的高度依次为2,1,4,5,1,3,3,测量是以长方形的宽度1为单位。
通常直方图被用来描述一些不连续的概率分布,例如, 字符在文本里出现的频率。请注意这些长方形的顺序,还有它们的高度,都非常重要。现在来计算有共同基线的直方图里最大的长方形区域,右图显示的就是这个直方图里最大的长方形区域。

输入

输入包含几组测试数据。每组数据以整数n开头描述一个由n个长方形组成的直方图。你可以假设
1<=n<=100000. 紧接着的n个整数h1.........hn(0<=hi<=1000000000)依次表示从左到右这些n个长方形的
高度。每个长方形的宽度都为1。0代表结束输入测试数据。

输出

每单独一行输出一组测试中直方图里最大长方形区域的面积.不要忘记这个长方形必须有共同的基线。



是不是用的金山快译
我英语特烂

2006-04-21 09:41
feng1256
Rank: 4
等 级:贵宾
威 望:14
帖 子:2899
专家分:0
注 册:2005-11-24
收藏
得分:0 

翻译工具都不行的(不灵活,而且经常翻译错)

我这个是查了写单词自己翻译滴(估计里面有很多错误,但大体意思没问题)


叁蓙大山:工謪、稅務、嗣發 抱歉:不回答女人的问题
2006-04-21 16:15
快速回复:请教源代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012683 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved