Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions weekly/week01/BOJ_0000_예시문제/gyuhyeok99.py

This file was deleted.

53 changes: 53 additions & 0 deletions weekly/week01/BOJ_10828_스택/gyuhyeok99.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include <iostream>
#include <stack>

using namespace std;

stack<int> 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;
}
27 changes: 27 additions & 0 deletions weekly/week01/BOJ_2750_수 정렬하기/gyuhyeok99.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int n;
vector<int> 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;
}