Skip to content

Instantly share code, notes, and snippets.

@k3kys

k3kys/1.cpp Secret

Created April 2, 2021 09:08
Show Gist options
  • Save k3kys/811285794e89d6ffc6f11303e549e344 to your computer and use it in GitHub Desktop.
Save k3kys/811285794e89d6ffc6f11303e549e344 to your computer and use it in GitHub Desktop.
연속 부분 증가수열
#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