algorithm/BOJ
BOJ 10828번 스택
_JunHo
2020. 1. 11. 11:40
BOJ : https://www.acmicpc.net/problem/10828
스택의 기본 구현을 묻는 문제이다.
더보기
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
|
#include <iostream>
#include <string>
#include <stack>
using namespace std;
stack<int> st;
int main() {
int N, num;
cin >> N;
string want;
while (N--) {
cin >> want;
if (want == "push") {
cin >> num;
}
if (want == "pop") {
else cout << "-1\n";
}
if (want == "top") {
else cout << "-1\n";
}
if (want == "size") {
cout << st.size() << '\n';
}
if (want == "empty") {
}
}
return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|