From fc86d5ddd7ffb3c3c4b45d36fdaea89eaabbad9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=83=9C=EC=98=A4?= Date: Fri, 27 May 2022 20:07:09 +0900 Subject: [PATCH 1/8] test --- .../(A) Game with Cards/CF129_A.cpp | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Codeforces/(2022.05.23) ECR_129/(A) Game with Cards/CF129_A.cpp diff --git a/Codeforces/(2022.05.23) ECR_129/(A) Game with Cards/CF129_A.cpp b/Codeforces/(2022.05.23) ECR_129/(A) Game with Cards/CF129_A.cpp new file mode 100644 index 0000000..025e39e --- /dev/null +++ b/Codeforces/(2022.05.23) ECR_129/(A) Game with Cards/CF129_A.cpp @@ -0,0 +1,48 @@ +#include +#define all(v) v.begin(),v.end() +#define endl "\n" +#define pii pair +#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) +#define fs first +#define sc second +#define ll long long +#define np(v) while(next_permutation(v.begin(),v.end())) +using namespace std; + +int n, m, t; +int k; +int tmp = 0; +int main() { + fastio; + vectora; vectorb; + cin >> t; + while (t--) { + a.clear(); b.clear(); + cin >> n; + for (int i = 0; i < n; i++) { + cin >> k; + a.push_back(k); + } + cin >> m; + for (int i = 0; i < m; i++) { + cin >> k; b.push_back(k); + } + sort(all(a)); + sort(all(b)); + if (a[n - 1] >= b[m - 1]) { + cout << "Alice" << endl; + } + else if (a[n - 1] <= b[m - 1]) { + cout << "Bob" << endl; + } + if (a[n - 1] <= b[m - 1]) { + cout << "Bob" << endl; + } + else if (a[n - 1] >= b[m - 1]) { + cout << "Alice" << endl; + } + + + + } +} \ No newline at end of file From 5e759afdb0d65e620129474e8f452dbb84fc09af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=83=9C=EC=98=A4?= Date: Sat, 4 Jun 2022 23:07:08 +0900 Subject: [PATCH 2/8] [CREATE] theo_sogang_A --- .../theo_sogang_A.cpp" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(A) \353\221\220~~\353\266\200 \353\221\220\353\266\200 \353\221\220\353\266\200/theo_sogang_A.cpp" diff --git "a/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(A) \353\221\220~~\353\266\200 \353\221\220\353\266\200 \353\221\220\353\266\200/theo_sogang_A.cpp" "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(A) \353\221\220~~\353\266\200 \353\221\220\353\266\200 \353\221\220\353\266\200/theo_sogang_A.cpp" new file mode 100644 index 0000000..79e518a --- /dev/null +++ "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(A) \353\221\220~~\353\266\200 \353\221\220\353\266\200 \353\221\220\353\266\200/theo_sogang_A.cpp" @@ -0,0 +1,26 @@ +#include +#define all(v) v.begin(),v.end() +#define endl "\n" +#define pii pair +#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) +#define fs first +#define sc second +#define ll long long +#define np(v) while(next_permutation(v.begin(),v.end())) +using namespace std; + +int n, m, k; +int main() { + cin >> n >> m >> k; + k -= 3; m += k; + m %= n; + if (m == 0) { + m = n; + } + if (m < 0) { + m = n + m; + } + cout << m; +} + + From de257ba41e7a149ef4f76467b93eb76cc586e3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=83=9C=EC=98=A4?= Date: Sat, 4 Jun 2022 23:09:29 +0900 Subject: [PATCH 3/8] [CREATE] theo_sogang_B --- .../theo_sogang_B.cpp" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(B) \354\262\255\354\240\225\354\210\230\354\227\264 (Easy)/theo_sogang_B.cpp" diff --git "a/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(B) \354\262\255\354\240\225\354\210\230\354\227\264 (Easy)/theo_sogang_B.cpp" "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(B) \354\262\255\354\240\225\354\210\230\354\227\264 (Easy)/theo_sogang_B.cpp" new file mode 100644 index 0000000..332568c --- /dev/null +++ "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(B) \354\262\255\354\240\225\354\210\230\354\227\264 (Easy)/theo_sogang_B.cpp" @@ -0,0 +1,22 @@ +#include +#define all(v) v.begin(),v.end() +#define endl "\n" +#define pii pair +#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) +#define fs first +#define sc second +#define ll long long +#define np(v) while(next_permutation(v.begin(),v.end())) +using namespace std; + + +int main() { + int res = 1; + int n; cin >> n; + for (int i = 1; i <= n; i++) { + res *= i; + } + cout << res; +} + + From 9da3cb2a624a779bd940ed41a9ff5944b44446b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=83=9C=EC=98=A4?= Date: Sat, 4 Jun 2022 23:11:42 +0900 Subject: [PATCH 4/8] [CREATE]theo_sogang_C --- .../theo_sogang_C.cpp" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 "Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(C) \354\204\234\352\260\225\354\235\230 \354\227\255\354\202\254\353\245\274 \354\260\276\354\225\204\354\204\234/theo_sogang_C.cpp" diff --git "a/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(C) \354\204\234\352\260\225\354\235\230 \354\227\255\354\202\254\353\245\274 \354\260\276\354\225\204\354\204\234/theo_sogang_C.cpp" "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(C) \354\204\234\352\260\225\354\235\230 \354\227\255\354\202\254\353\245\274 \354\260\276\354\225\204\354\204\234/theo_sogang_C.cpp" new file mode 100644 index 0000000..2b64be8 --- /dev/null +++ "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(C) \354\204\234\352\260\225\354\235\230 \354\227\255\354\202\254\353\245\274 \354\260\276\354\225\204\354\204\234/theo_sogang_C.cpp" @@ -0,0 +1,29 @@ +#include +#define all(v) v.begin(),v.end() +#define endl "\n" +#define pii pair +#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) +#define fs first +#define sc second +#define ll long long +#define np(v) while(next_permutation(v.begin(),v.end())) +using namespace std; + + +int main() { + int n, m; cin >> n >> m; + int a[1001] = {}, b[1001] = {}; + for (int i = 0; i < n; i++) { + cin >> a[i]; + } + for (int i = 0; i < m; i++) { + cin >> b[i]; + } + int mx = -1e9; + for (int i = 0; i < max(n, m); i++) { + mx = max(b[i] - a[i], mx); + } + cout << (mx < 0 ? 0 : mx); +} + + From 51e2fdda592a7c8b69a49dad867e194569b4931a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=83=9C=EC=98=A4?= Date: Sat, 4 Jun 2022 23:15:15 +0900 Subject: [PATCH 5/8] [CREATE] theo_sogang_D --- .../theo_sogang_D.cpp" | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 "Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(D) \353\221\220\353\235\274\353\254\264\353\246\254 \355\234\264\354\247\200/theo_sogang_D.cpp" diff --git "a/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(D) \353\221\220\353\235\274\353\254\264\353\246\254 \355\234\264\354\247\200/theo_sogang_D.cpp" "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(D) \353\221\220\353\235\274\353\254\264\353\246\254 \355\234\264\354\247\200/theo_sogang_D.cpp" new file mode 100644 index 0000000..5330c6a --- /dev/null +++ "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(D) \353\221\220\353\235\274\353\254\264\353\246\254 \355\234\264\354\247\200/theo_sogang_D.cpp" @@ -0,0 +1,55 @@ +#include +#define all(v) v.begin(),v.end() +#define endl "\n" +#define pii pair +#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) +#define fs first +#define sc second +#define ll long long +#define np(v) while(next_permutation(v.begin(),v.end())) +using namespace std; + + +int main() { + int n; cin >> n; string st1; string st2; + cin >> st1; + cin >> st2; + if (st1[0] != st2[0] || st1[n - 1] != st2[n - 1]) { + cout << "NO"; return 0; + } + char arr[5] = { 'a','e','i','o','u' }; + vectora; vectorb; + for (int i = 1; i < st1.size() - 1; i++) { + for (int k = 0; k < 5; k++) { + if (st1[i] == arr[k]) { + a.push_back(arr[k]); + st1.erase(st1.begin() + i); + i--; + break; + } + } + } + for (int i = 1; i < st2.size() - 1; i++) { + for (int k = 0; k < 5; k++) { + if (st2[i] == arr[k]) { + b.push_back(arr[k]); + st2.erase(st2.begin() + i); + i--; + break; + } + } + } + sort(all(a)); sort(all(b)); + if (st1 != st2) { + cout << "NO"; return 0; + } + if (a.size() != b.size()) { + cout << "NO"; return 0; + } + for (int i = 0; i < a.size(); i++) { + if (a[i] != b[i]) { + cout << "NO"; return 0; + } + } + cout << "YES"; +} \ No newline at end of file From a545bae9ab4a5bc8d4a2856db11a636805bfa15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=83=9C=EC=98=A4?= Date: Sat, 4 Jun 2022 23:16:52 +0900 Subject: [PATCH 6/8] [CREATE]theo_sogang_E --- .../theo_sogang_E.cpp" | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 "Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(E) \353\260\260\354\212\244\355\202\250\353\235\274\353\271\210\354\212\244~N~\352\267\200\354\227\275\352\263\240~\352\271\234\354\260\215\355\225\230\352\262\214~/theo_sogang_E.cpp" diff --git "a/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(E) \353\260\260\354\212\244\355\202\250\353\235\274\353\271\210\354\212\244~N~\352\267\200\354\227\275\352\263\240~\352\271\234\354\260\215\355\225\230\352\262\214~/theo_sogang_E.cpp" "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(E) \353\260\260\354\212\244\355\202\250\353\235\274\353\271\210\354\212\244~N~\352\267\200\354\227\275\352\263\240~\352\271\234\354\260\215\355\225\230\352\262\214~/theo_sogang_E.cpp" new file mode 100644 index 0000000..eac185e --- /dev/null +++ "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(E) \353\260\260\354\212\244\355\202\250\353\235\274\353\271\210\354\212\244~N~\352\267\200\354\227\275\352\263\240~\352\271\234\354\260\215\355\225\230\352\262\214~/theo_sogang_E.cpp" @@ -0,0 +1,21 @@ +#include +#define all(v) v.begin(),v.end() +#define endl "\n" +#define pii pair +#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) +#define fs first +#define sc second +#define ll long long +#define np(v) while(next_permutation(v.begin(),v.end())) +using namespace std; + + +int main() { + ll n, m; cin >> n >> m; + if ((n - 1) % (m + 1)) { + cout << "Can win"; return 0; + } + cout << "Can't win"; +} + + From 44fc193a92aaf3bed59e94faea2de889ea7ff6cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=83=9C=EC=98=A4?= Date: Sat, 4 Jun 2022 23:18:28 +0900 Subject: [PATCH 7/8] [CREATE] theo_sogang_F.cpp --- .../theo_sogang_F.cpp" | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 "Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(F) \354\215\270 \355\214\260\353\246\260\353\223\234\353\241\254/theo_sogang_F.cpp" diff --git "a/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(F) \354\215\270 \355\214\260\353\246\260\353\223\234\353\241\254/theo_sogang_F.cpp" "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(F) \354\215\270 \355\214\260\353\246\260\353\223\234\353\241\254/theo_sogang_F.cpp" new file mode 100644 index 0000000..c072f49 --- /dev/null +++ "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(F) \354\215\270 \355\214\260\353\246\260\353\223\234\353\241\254/theo_sogang_F.cpp" @@ -0,0 +1,40 @@ +#include +#define all(v) v.begin(),v.end() +#define endl "\n" +#define pii pair +#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) +#define fs first +#define sc second +#define ll long long +#define np(v) while(next_permutation(v.begin(),v.end())) +using namespace std; + + +int main() { + int n; + cin >> n; + if (n <= 9) { + cout << 1; return 0; + } + if (n <= 18) { + if (n %= 2) { + cout << 3; return 0; + } + cout << 2; return 0; + } + int tmp = n / 18; + int t = n % 18; + if (!t) { + cout << tmp * 2; return 0; + } + if (t <= 9) { + cout << tmp * 2 + 1; return 0; + } + if (t %= 2) { + cout << tmp * 2 + 3; return 0; + } + cout << tmp * 2 + 2; + +} + + From 3760a001a89c1fab060cca1b1a6c80658609bf97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=83=9C=EC=98=A4?= Date: Sat, 4 Jun 2022 23:19:48 +0900 Subject: [PATCH 8/8] [CREATE] theo_sogang_H --- .../theo_sogang_H.cpp" | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 "Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(H) \354\262\255\354\240\225\354\210\230\354\227\264 (Hard)/theo_sogang_H.cpp" diff --git "a/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(H) \354\262\255\354\240\225\354\210\230\354\227\264 (Hard)/theo_sogang_H.cpp" "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(H) \354\262\255\354\240\225\354\210\230\354\227\264 (Hard)/theo_sogang_H.cpp" new file mode 100644 index 0000000..3765c9e --- /dev/null +++ "b/Baekjoon Contest/(2022.06.04) 2022 \354\204\234\352\260\225\353\214\200\355\225\231\352\265\220 \354\262\255\354\240\225\354\210\230\354\273\265-\354\203\210\353\202\264\352\270\260 Round/(H) \354\262\255\354\240\225\354\210\230\354\227\264 (Hard)/theo_sogang_H.cpp" @@ -0,0 +1,32 @@ +#include +#define all(v) v.begin(),v.end() +#define endl "\n" +#define pii pair +#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) +#define fs first +#define sc second +#define ll long long +#define np(v) while(next_permutation(v.begin(),v.end())) +using namespace std; + +ll mx = 1e9 + 7; +int main() { + ll n; + ll tmp = 0; + cin >> n; + for (ll i = 1; i <= n; i++) { + tmp += i; + } + tmp %= mx; + ll res = 0; + for (ll i = 1; i <= n; i++) { + res += (tmp + i) * i; + res %= mx; + } + cout << res << ' '; + res = 1; + for (ll i = 1; i <= n; i++) { + res *= i; res %= mx; + } + cout << (res * res) % mx; +}