diff --git "a/weekly/week01/BOJ_0000_\354\230\210\354\213\234\353\254\270\354\240\234/gyuhyeok99.py" "b/weekly/week01/BOJ_0000_\354\230\210\354\213\234\353\254\270\354\240\234/gyuhyeok99.py" deleted file mode 100644 index f393568..0000000 --- "a/weekly/week01/BOJ_0000_\354\230\210\354\213\234\353\254\270\354\240\234/gyuhyeok99.py" +++ /dev/null @@ -1,13 +0,0 @@ -# BOJ 0000: 예시 문제 -# https://www.acmicpc.net/problem/0000 - -# 문제 풀이 -# 알고리즘: 구현 -# 시간 복잡도: O(n) - -def solution(): - # 여기에 풀이 코드를 작성합니다 - pass - -if __name__ == "__main__": - solution() diff --git "a/weekly/week01/BOJ_10828_\354\212\244\355\203\235/gyuhyeok99.cpp" "b/weekly/week01/BOJ_10828_\354\212\244\355\203\235/gyuhyeok99.cpp" new file mode 100644 index 0000000..dd7c834 --- /dev/null +++ "b/weekly/week01/BOJ_10828_\354\212\244\355\203\235/gyuhyeok99.cpp" @@ -0,0 +1,53 @@ +#include +#include + +using namespace std; + +stack s; +int n; +int main() { + ios::sync_with_stdio(false); + cin.tie(NULL); cout.tie(NULL); + + cin >> n; + for(int i = 0; i < n; i++) { + string cmd; + int x; + cin >> cmd; + + if (cmd == "push") { + cin >> x; + s.push(x); + } + else if (cmd == "pop") { + + if (s.empty()) { + cout << -1 << endl; + } + + else { + cout << s.top() << endl; + s.pop(); + } + } + else if(cmd == "size") { + cout << s.size() << endl; + } + else if(cmd == "empty") { + if(s.empty()) { + cout << 1 << endl; + }else { + cout << 0 << endl; + } + } + else if(cmd == "top") { + if(s.empty()) { + cout << -1 << endl; + } + else { + cout << s.top() << endl; + } + } + } + return 0; +} diff --git "a/weekly/week01/BOJ_2750_\354\210\230 \354\240\225\353\240\254\355\225\230\352\270\260/gyuhyeok99.cpp" "b/weekly/week01/BOJ_2750_\354\210\230 \354\240\225\353\240\254\355\225\230\352\270\260/gyuhyeok99.cpp" new file mode 100644 index 0000000..8375f82 --- /dev/null +++ "b/weekly/week01/BOJ_2750_\354\210\230 \354\240\225\353\240\254\355\225\230\352\270\260/gyuhyeok99.cpp" @@ -0,0 +1,27 @@ +#include +#include +#include + +using namespace std; + +int n; +vector v; +int main() { + ios::sync_with_stdio(false); + cin.tie(NULL); cout.tie(NULL); + + cin >> n; + for (int i = 0; i < n; i++) { + int x; + cin >> x; + v.push_back(x); + } + + sort(v.begin(), v.end()); + + for (int num : v) { + cout << num << '\n'; + } + + return 0; +}