From 8953c198f8229c34e49b6e54dbb988c0503ec2b6 Mon Sep 17 00:00:00 2001 From: aqswa <69039161+aqswa@users.noreply.github.com> Date: Mon, 20 Sep 2021 08:52:22 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=9A=B0=EC=84=A0=EC=88=9C=EC=9C=84=20?= =?UTF-8?q?=ED=81=90]=209=EC=9B=94=2020=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../11286.cpp" | 34 ++++++++ .../11723.cpp" | 51 ++++++++++++ .../12018.cpp" | 49 ++++++++++++ .../15903.cpp" | 35 +++++++++ .../3613.cpp" | 77 +++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 "9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/11286.cpp" create mode 100644 "9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/11723.cpp" create mode 100644 "9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/12018.cpp" create mode 100644 "9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/15903.cpp" create mode 100644 "9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/3613.cpp" diff --git "a/9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/11286.cpp" "b/9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/11286.cpp" new file mode 100644 index 0000000..3ab2389 --- /dev/null +++ "b/9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/11286.cpp" @@ -0,0 +1,34 @@ +#include +#include + +using namespace std; + +struct cmp{ + bool operator()(int &a, int &b){ + if(abs(a) != abs(b)) + return abs(a) > abs(b); + return a > b; + } +}; + +int main(){ + int n; + cin >> n; + + priority_queue, cmp> pq; + for(int i=0; i> t; + if(t == 0){ + if(!pq.empty()) { + cout << pq.top() << '\n'; + pq.pop(); + } + else + cout << '0' << '\n'; + } + else + pq.push(t); + } +} + diff --git "a/9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/11723.cpp" "b/9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/11723.cpp" new file mode 100644 index 0000000..e883fb0 --- /dev/null +++ "b/9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/11723.cpp" @@ -0,0 +1,51 @@ + +#include +#include + +using namespace std; + +int main() { + + ios::sync_with_stdio(false); + cin.tie(NULL); + + vector s(21, false); + + int n; + cin >> n; + + string str; + + for (int i = 0; i < n; i++) { + cin >> str; + int x; + if (str == "all") { + for (int i = 1; i < 21; i++) { + s[i] = true; + } + } else if (str == "empty") { + for (int i = 1; i < 21; i++) { + s[i] = false; + } + } else if (str == "add") { + cin >> x; + if (!s[x]) + s[x] = true; + } else if (str == "remove") { + cin >> x; + if (s[x]) + s[x] = false; + } else if (str == "check") { + cin >> x; + if (s[x]) + cout << '1' << '\n'; + else + cout << '0' << '\n'; + } else { + cin >> x; + s[x] = !s[x]; + } + } +} + + diff --git "a/9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/12018.cpp" "b/9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/12018.cpp" new file mode 100644 index 0000000..23d24bc --- /dev/null +++ "b/9\354\233\224 20\354\235\274 - \354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/12018.cpp" @@ -0,0 +1,49 @@ + +#include +#include + +using namespace std; + +int main(){ + int n, m; + cin >> n >> m; + + priority_queue, greater<>> least; + priority_queue temp; + + for(int i=0; i> people >> limit; + //신청한 사람이 수강인원보다 작다면 + if(people < limit){ + least.push(1); + for(int j=0; j> t; + } + } + else{ + temp = priority_queue(); + for(int j=0; j> t; + temp.push(t); + } + //최소로 배당해야할 마일리지 찾고 입력 + for(int j=0; j +#include + +using namespace std; + +int main(){ + int n, m; + cin >> n >> m; + + priority_queue, greater<>> q; + + for(int i=0; i> t; + q.push(t); + } + + for(int i=0; i + +using namespace std; + +string from_cpp(int i, string answer, string str){ + for(int j=i; j> str; + + string answer = ""; + //첫글자가 _, 대문자이거나 마지막이 _이면 에러 + if(str[0] == '_' || ('A' <= str[0] && str[0] <= 'Z') || str[str.length()-1] == '_'){ + cout << "Error!"; + return 0; + } + else{ + answer += str[0]; + } + + for(int i=1; i