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; +} + + 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; +} + + 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); +} + + 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 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"; +} + + 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; + +} + + 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; +} 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