Logo
(追記) (追記ここまで)

25527번 - Counting Peaks of Infection 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB42234729984.943%

문제

For the new infectious disease, COVID-99, numbers of new positive cases of PCR tests conducted in the city are reported daily. You are requested by the municipal public relations department to write a program that counts the number of the peaks so far of the positive cases.

Here, the number of peaks is the number of days on which the number of positive cases reported is more than both of the day before and the next day.

As the PCR tests started before the disease started spreading in the city, the number of positive cases is zero on the first day. The last reported day is not counted as a peak. No two consecutive days have the same number of positive cases.

Figure A-1: Numbers of positive cases of the last dataset in Sample Input. Red circles indicate the peaks.

입력

The input consists of multiple datasets. Each dataset is in the following format.

n
v1 ... vn

n is the number of days on which the numbers of positive cases are reported (3 ≤ n ≤ 1000). vi is the number of positive cases on the i-th day, an integer between zero and 1000, inclusive. Note that v1 is zero, and vivi+1 for 1 ≤ i < n, as stated above.

The end of the input is indicated by a line containing a zero. The input consists of at most 100 datasets.

출력

For each dataset, output the number of peaks in a line.

제한

예제 입력 1

3
0 1000 0
5
0 1 2 0 1
3
0 1 2
7
0 1 0 1 8 7 6
11
0 4 3 7 6 10 7 8 4 6 10
0

예제 출력 1

1
1
0
2
4

힌트

출처

ICPC > Regionals > Asia Pacific > Japan > Japan Domestic Contest > 2022 Japan Domestic Contest A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /