No Rules Rules

첨탑 밀어서 부수기 (feat. 백준, 28014번) 본문

생활/코테

첨탑 밀어서 부수기 (feat. 백준, 28014번)

개발하는 완두콩 2023. 5. 17. 12:04
728x90
반응형

첨탑 밀어서 부수기
https://www.acmicpc.net/problem/28014

 

28014번: 첨탑 밀어서 부수기

첫째 줄에 첨탑의 개수 $N$이 주어진다. $(1\leq N\leq 5\,000\,000)$ 둘째 줄에는 앞에서부터 차례대로 첨탑의 높이 $H_1, H_2, \cdots, H_n (1\leq H_i\leq 1\,000\,000)$ 이 주어진다. 입력으로 주어지는 모든 수는 정

www.acmicpc.net

 

// woohyeon.kim
// kim519620.tistory.com
#include <iostream>
using namespace std;
int main(){
	ios::sync_with_stdio(false), cin.tie(NULL);
    register int N, t1 = 0, t2, cnt = 0;
    cin >> N;
    for(register int n = 0; n < N; ++n){
        cin >> t2;
        if(t1 <= t2)
            ++cnt;
        t1 = t2;
    }
    cout << cnt;
    return 0;
}
// *&)*@*

 

반응형

단순 연산 문제입니다.

728x90
반응형
Comments