알고리즘 문제/BOJ
14910번 오르막
parkit
2018. 11. 3. 23:45
728x90
반응형
https://www.acmicpc.net/problem/14910
EOF를 잘 사용하면 된다.
입력으로 주어지는 정수는 -1,000,000보다 크거나 같고,
1,000,000보다 작거나 같은 정수이기 때문에
b = -1000001로 초기화 시켜주면 된다.
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 29 30 31 32 33 34 35 36 37 | #include <iostream> #include <queue> #include <stack> #include <cstdio> #include <vector> #include <cstring> #include <string> #include <math.h> #include <algorithm> #include <map> using namespace std; int main(void) { int a = 0, b = -1000001; bool stop = false; while (scanf("%d", &a) != EOF) { if (a < b) { stop = true; break; } else { b = a; } } if (stop) printf("Bad\n"); else printf("Good\n"); return 0; } | cs |
728x90
반응형