Problem D. What a Beautiful Lake

Description

Weiming Lake, also named "Un-named Lake", is the most famous scenic spot in Peking University. It is located in the north of the campus and is surrounded by walking paths, small gardens, and old red buildings with typical Chinese curly roofs. The lake was
once the royal garden in Qing Dynasty. Boya tower stands on a little hill beside the lake. The lake and the tower form a distinctive landscape and a symbol of Peking University.

Weiming Lake is a very good place for studying, reading, skating in the winter, and of course, jogging. More and more students and teachers run or walk around Weiming Lake every day and show how many paces they have covered in the mobile app WeChat Sports
to get "Zans" (applauses).

ACMer X also enjoys jogging around Weiming Lake. His watch can measure and record an altitude value every meter. After a round of running, X collected the altitude data around the lake. Now he wants to find out the longest slope around the lake.

Input

There are no more than 20 test cases.

Each case has two lines.

The first line is an integer N (2 <= N <= 100) meaning that the length of the road around the lake is N meters.

The second line contains N integers a1,a2...aN, (0<= a1,a2...aN <= 100) indicating N altitude sample values around the lake. The samples are given in clockwise order, and the distance between
two adjacent samples is one meter. Of course the distance between a1 and aN is also one meter.

The input ends by a line of 0.

Output

For each test case, print the length of the longest slope in meters. A slope is a part of the road around the lake, and it must keep going up or going down. If there are no slope, print 0.

Sample Input

4

1 1 1 1

8

5 1 2 3 4 5 6 2

6

5 4 3 2 1 2

10

1 0 2 3 2 2 3 4 3 2

0

Sample Output

0

5

4

4

hihocoder 1425What a Beautiful Lake(实验专用)的更多相关文章

  1. hihoCoder 1425 : What a Beautiful Lake(美丽滴湖)

    hihoCoder #1425 : What a Beautiful Lake(美丽滴湖) 时间限制:1000ms 单点时限:1000ms 内存限制:256MB Description - 题目描述 ...

  2. Problem D. What a Beautiful Lake dp

    Problem D. What a Beautiful Lake Description Weiming Lake, also named "Un-named Lake", is ...

  3. English trip V1 - B 14. There Are Flowers in My Office 我办公室里有花 Teacher:Lamb Key: There be(is/are)

    In this lesson you will learn to describe a room or place. 这节课讲学习描述一个房间或地方 课上内容(Lesson) 1. Where do ...

  4. The 2016 ACMICPC Asia Beijing Regional Contest

    A. Harmonic Matrix Counter (3/19) B. Binary Tree (1/14) C. Asa's Chess Problem (21/65) [ Problem ] 给 ...

  5. hihocoder 1061.Beautiful String

    题目链接:http://hihocoder.com/problemset/problem/1061 题目意思:给出一个不超过10MB长度的字符串,判断是否里面含有一个beautiful strings ...

  6. hihoCoder 1596 : Beautiful Sequence

    Description Consider a positive integer sequence a[1], ..., a[n] (n ≥ 3). If for every 2 ≤ i ≤ n-1, ...

  7. 实验吧 ---- 隐写术之so beautiful so white

    因为好久没有写博客,所以今天本宝宝要弥补这个过错,一下子更新许多文章,希望各位小伙伴能够原谅,以后我会加倍努力的! 这一次主要都是实验吧里面的 关于隐写术方面的知识,后续我会上传一些解密工具,希望能够 ...

  8. 实验吧-隐写-FIVE1、so beautiful so white(文件头修改)

    FIVE1 下载图片,kali下foremost恢复文件,将得到的图片用Winhex打开进行观察,发现最后面有一段貌似是代码的东西. LS0uLi4gIC4tICAuLi4uLiAgLS0uLi4gI ...

  9. MS SQL专用管理员连接DAC

    在SQL SERVER 2005中,微软引入了一个叫做数据库专用管理员连接方式(DAC Dedicated Administrator Connection)的特性,使用这个新特性,数据库管理员可以在 ...

随机推荐

  1. HDU 4366 Successor 分块做法

    http://acm.hdu.edu.cn/showproblem.php?pid=4366 今日重新做了这题的分块,果然是隔太久了,都忘记了.. 首先,用DFS序变成一维的问题 关键是它有两个权值, ...

  2. RHEL 6.5----SCSI存储

    主机名 IP master 192.168.30.130 node-1 192.168.30.131 node-2 192.168.30.132 安装并启动 [root@master ~]# ll / ...

  3. [转]ASP.NET MVC URL重写与优化(进阶篇)-继承RouteBase玩转URL

    本文转自:http://www.cnblogs.com/John-Connor/archive/2012/05/03/2478821.html 引言-- 在初级篇中,我们介绍了如何利用基于ASP.NE ...

  4. 迭代器———更锋利的C#代码小记(3)

    直接使用yield return关键字通过类似返回值的方式灵活地构造迭代器 public class EmployeeCollection :IEnumerable<Employee> { ...

  5. 原创 Repeater radio 单选和多选混合

    希望高手朋友给我留下美好的意见,在此先感谢您! 前台代码repeater: <script src="../Scripts/jquery-1.9.1.js"></ ...

  6. VBA 连接sql server的用法

    cnnstr = "Provider=sqloledb;Data Source=192.211.21.8;Initial Catalog=pub;UID=账号;PWD=密码" VB ...

  7. 响应式布局(CSS3弹性盒flex布局模型)

    传统的布局方式都是基于盒模型的 利用display.position.float来布局有一定局限性 比如说实现自适应垂直居中 随着响应式布局的流行,CSS3引入了更加灵活的弹性布局模型 flex弹性布 ...

  8. 7-Java-C(搭积木)

    题目描述: 小明最近喜欢搭数字积木, 一共有10块积木,每个积木上有一个数字,0~9. 搭积木规则: 每个积木放到其它两个积木的上面,并且一定比下面的两个积木数字小. 最后搭成4层的金字塔形,必须用完 ...

  9. android 解密工具

    androguard. 这个是python写的 安装: pip install androguard

  10. caffe proto

    所在目录为: /src/caffe/proto 在caffe.proto中定义了很多结构化数据,比如LayerParameter.Datum.NetParameter.SolverParameter. ...