Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 백트래킹
- BFS
- 알고리즘
- 백준
- 재귀
- 우선순위 큐
- Unreal Engine 5
- 유니온 파인드
- 자료구조
- ue5
- 그래프
- 시뮬레이션
- 누적 합
- 그리디 알고리즘
- XR Interaction Toolkit
- Team Fortress 2
- 브루트포스
- 구현
- 다익스트라
- 스택
- DFS
- 투 포인터
- 트리
- c++
- 유니티
- 정렬
- 다이나믹 프로그래밍
- 수학
- VR
- 문자열
Archives
- Today
- Total
1일1알
백준 11536번 줄 세우기 C++ 본문
https://www.acmicpc.net/problem/11536
11536번: 줄 세우기
이름이 증가하는 순으로 나타나면 INCREASING, 감소하는 순이면 DECREASING을 한 줄에 출력한다. 만약 위의 두 경우가 아니라면 NEITHER를 출력한다.
www.acmicpc.net
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <set>
#include <map>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <limits.h>
using namespace std;
using int64 = long long;
int n;
vector<string> v;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
v = vector<string>(n);
int incCnt = 0;
int decCnt = 0;
for (int i = 0; i < n; i++) {
cin >> v[i];
}
for (int i = 0; i < n - 1; i++) {
if (v[i] < v[i + 1]) incCnt++;
else decCnt++;
}
if (incCnt == n - 1) cout << "INCREASING";
else if (decCnt == n - 1) cout << "DECREASING";
else cout << "NEITHER";
}
'알고리즘' 카테고리의 다른 글
백준 17413번 단어 뒤집기 C++ (0) | 2023.05.15 |
---|---|
백준 17085번 십자가 2개 놓기 C++ (1) | 2023.05.14 |
백준 12933번 오리 C++ (0) | 2023.05.12 |
백준 15671번 오델로 C++ (0) | 2023.05.11 |
백준 25206번 너의 평점은 C++ (0) | 2023.05.09 |