-->
当前位置:首页 > 题库

PROGRAMMING:Keven Goo Goo Goo

Luz5年前 (2021-05-10)题库479
The story of this question is cooing
Given a sequence of numbers, find the maximum number of disjoint and equal intervals.
In order to reduce the difficulty of the question, you need to output the number of intervals in a line
###Input format:
The first line contains an integer $$n $$($$1 < = n < = 1500 $$) to represent the length of the array.
The second line contains $$n $$numbers representing the elements in the array$$- 10^5<=a_ i<=10^5$$).
###Output format:
Output the integer $$k $$in the first line, which means there are $$k $$disjoint intervals and equal intervals.
###Input example:
```in
seven
4 1 2 2 1 5 3
```
```in
eleven
-5 -4 -3 -2 -1 0 1 2 3 4 5
```
###Output example:
```out
three
```
```out
two
```
###Explanation
In the first example, the three intervals are [2,3], [4,5], [7,7].
In the second example, the two intervals are [1,1], [3,4]







answer:If there is no answer, please comment