-
-
Save k3kys/811285794e89d6ffc6f11303e549e344 to your computer and use it in GitHub Desktop.
연속 부분 증가수열
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int n; | |
vector<int> a; | |
int main(void) { | |
cin >> n; | |
for (int i = 0; i < n; i++) { | |
int x; | |
cin >> x; | |
a.push_back(x); | |
} | |
int cnt = 1, max = -2147000000; | |
for (int i = 0; i < n - 1; i++) { | |
if (a[i] <= a[i + 1]) cnt++; | |
else cnt = 1; | |
if (cnt > max) max = cnt; | |
} | |
cout << max; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment