boj 1874
[백준 1874번-C++] 스택 수열
http://acmicpc.net/problem/1874 {코드} #include #include using namespace std; int main() { int n, num, cur = 1; stack s; string ans = ""; scanf("%d", &n); for (int i = 0; i = cur) { while (num + 1 != cur) { s.push(cur++); ans += "+\n"; } s.pop(); ans += "-\n"; } else { if (s.top() == num) { s.pop(); ans += "-\n"; } else { ans = "NO"; break; } } } cout