您好,欢迎光临本网站![请登录][注册会员]  
文件名称: Mountain Watching
  所属分类: 其它
  开发工具:
  文件大小: 536byte
  下载次数: 0
  上传时间: 2010-06-03
  提 供 者: wuyadong********
 详细说明: Description Mountain Watching [Jeffrey Wang, 2009] One day, Bessie was gazing off into the distance at the beautiful Wisconsin mountains when she wondered to herself: which mountain is the widest one? She decided to take N (1 <= N <= 100,000) equally-spaced height measurements H_i (1 <= H_i <= 1,000,000,000) sequentially along the horizon using her new Acme Long Distance Geoaltimeter. A mountain is defined to be a consecutive sequence of H_i values which increases (or stays the same) and then decreases (or s tays the same), e.g., 2, 3, 3, 5, 4, 4, 1. It is possible for a mountain on the edge of her field of vision only to increase or only to decrease in height, as well. The width of a mountain is the number of measurements it encompasses. Help Bessie identify the widest mountain. Here's a simple example of a typical horizon: ******* * ********* *** ********** ***** *********** ********* * * ***************** *********** *** * ** ******************* ************* * * ******* * ********************************************************************** 3211112333677777776543332111112344456765432111212111112343232111111211 aaaaaa ccccccccccccccccccccc eeeeeee ggggggggg bbbbbbbbbbbbbbbbbbbbbbbbbbbb ddddd ffffffffff hhhhhhhhh The mountains are marked 'a', 'b', etc. Obviously, mountain b is widest with width 28. The mountain on the left has width 6 for the purposes of this task. Input * There are multiple test cases. * For each case: ** Line 1: A single integer: N ** Lines 2..N+1: Line i+1 contains a single integer: H_i Output * For each case: ** Line 1: A single line with a single integer that is the width of the widest mountain. Sample Input 7 3 2 3 5 4 1 6 INPUT DETAILS: The height measurements are 3, 2, 3, 5, 4, 1, 6. Sample Output 5 OUTPUT DETAILS: The widest mountain consists of the measurements 2, 3, 5, 4, 1. Other mountains include 3, 2 and 1, 6 ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: ACM Mountain Watching
 输入关键字,在本站1000多万海量源码库中尽情搜索: