CITY2 - A Famous City

题意翻译

## 题目描述 b先生到达华沙后,他惊叹于城市摩天大厦的规模宏大,禁不住拍照留念。 但现在,当他再回味以前的照片时,他惊讶地发现他甚至不能明确说出照片里建筑物的数量。 所以他准备了如下计划: 1. 把照片中的建筑物视为下边是地平线的长方形,然后把照片从左到右分成n个宽度相等的部分。 一栋建筑可以横跨几个部分,但一个部分里最多可以视作一栋可见的完整建筑物(即为建筑物的最小单位)。 2. 分别计算每个部分里能够看见的建筑物的高度。 -编写一个程序来计算建筑物的最小数量。 3. 先生已经完成了前两步,现在轮到你来完成最后一步了。 ## 输入输出格式 ### 输入格式: 多组数据。每组数据以包含一个整数nnn的行开始(1<n<=100000)(1<n<=100000)(1<n<=100000)。接下来的一行包括nnn个整数hhh (0<=hi<=1000000000)(0<=h_i<=1000000000)(0<=hi​<=1000000000),其中hih_ihi​表示第iii个块中的可视建筑物的高度。注意:hi=0h_i=0hi​=0意味着这一部分没有建筑物。 ### 输出格式: 对于每一组数据,输出一行包括当前是第几组测试数据和对应数据的建筑物的最小数量。 ## 说明 样例的可能情况如下: ![orz](http://acm.hdu.edu.cn/data/images/C410-1008-1.jpg)

题目描述

After Mr. B arrived in Warsaw, he was shocked by the skyscrapers and took several photos. But now when he looks at these photos, he finds in surprise that he isn't even able to point out the number of buildings in it. So he decides to work it out as follows: \- divide the photo into n vertical pieces from left to right. The buildings in the photo can be treated as rectangles, the lower edge of which is the horizon. One building may span several consecutive pieces, but each piece can only contain one visible building, or no buildings at all. \- measure the height of each building in that piece. \- write a program to calculate the minimum number of buildings. Mr. B has finished the first two steps, the remaining comes to you.

输入输出格式

输入格式


Each test case starts with a line containing an integer **n** (1 <= **n** <= 100,000). Following this is a line containing **n** integers - the height of building in each piece respectively. Note that zero height means there are no buildings in this piece at all. All the input numbers will be nonnegative and less than 1,000,000,000.

输出格式


For each test case, display a single line containing the case number and the minimum possible number of buildings in the photo.

输入输出样例

输入样例 #1

3
1 2 3
3
1 2 1

输出样例 #1

Case 1: 3
Case 2: 2