From 9217914a1f6541f3333f14159cbe206c2fe464e0 Mon Sep 17 00:00:00 2001 From: MIN-JU-CHO <60171052+MIN-JU-CHO@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:52:17 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=ED=96=89=EB=A0=AC=20=EA=B3=B1=EC=85=88=20?= =?UTF-8?q?=EC=88=9C=EC=84=9C=2011049=20-=20C++?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MinjuCho/11049.cpp" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/11049.cpp" diff --git "a/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/11049.cpp" "b/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/11049.cpp" new file mode 100644 index 0000000..36c323b --- /dev/null +++ "b/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/11049.cpp" @@ -0,0 +1,27 @@ +#include +#include +const int INF = 0x6f6f6f6f; +int dp[501][501]; +int main(void) +{ + int N; + scanf("%d", &N); + int matrix[501][2]; + for (int i = 1; i <= N; ++i) + { + scanf("%d %d", &matrix[i][0], &matrix[i][1]); + } + for (int i = 1; i <= N-1; ++i) + { + for (int j = 1; i + j <= N; ++j) + { + dp[j][i+j] = INF; + for (int k = j; k <= i + j; ++k) + { + dp[j][i + j] = std::min(dp[j][i + j], dp[j][k] + dp[k + 1][i + j] + + matrix[j][0] * matrix[k][1] * matrix[i + j][1]); + } + } + } + printf("%d", dp[1][N]); +} \ No newline at end of file From eeba2eb62476361234a539c2cf579d145c9af9e3 Mon Sep 17 00:00:00 2001 From: MIN-JU-CHO <60171052+MIN-JU-CHO@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:52:41 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=ED=96=89=EB=A0=AC=20=EA=B3=B1=EC=85=88=20?= =?UTF-8?q?=EC=88=9C=EC=84=9C=2011049=20-=20=ED=8C=8C=EC=9D=B4=EC=8D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MinjuCho/11049.py" | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 "Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/11049.py" diff --git "a/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/11049.py" "b/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/11049.py" new file mode 100644 index 0000000..10dda0a --- /dev/null +++ "b/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/11049.py" @@ -0,0 +1,16 @@ +import sys +input = sys.stdin.readline +N = int(input().strip()) +matrix = [[]] +for i in range(1, N+1): + matrix.append(list(map(int, input().strip().split()))) +dp=[[0 for _ in range(N+1)] for __ in range(N+1)] +INF = int(1e9) +for i in range(1, N): + j = 1 + while i+j <= N: + dp[j][i+j] = INF + for k in range(j, i+j): + dp[j][i+j] = min(dp[j][i+j], dp[j][k] + dp[k+1][i+j] + matrix[j][0] * matrix[k][1] * matrix[i+j][1]) + j+=1 +print(dp[1][N]) From daad750642f4696870e540ca3dcfbfc63c35489a Mon Sep 17 00:00:00 2001 From: MIN-JU-CHO <60171052+MIN-JU-CHO@users.noreply.github.com> Date: Mon, 19 Feb 2024 19:10:45 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=EC=95=B1=207579=20-=20C++?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MinjuCho/7579.cpp" | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 "Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/7579.cpp" diff --git "a/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/7579.cpp" "b/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/7579.cpp" new file mode 100644 index 0000000..85e05e9 --- /dev/null +++ "b/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/7579.cpp" @@ -0,0 +1,41 @@ +#include +#include +#include +using namespace std; +int main(void) +{ + int N, M, sum = 0; + scanf("%d %d", &N, &M); + + vector m(N+1), c(N+1); + for (int i = 1; i <= N; ++i) + { + scanf("%d", &m[i]); + } + for (int i = 1; i <= N; ++i) + { + scanf("%d", &c[i]); + sum += c[i]; + } + + vector> dp(N + 1, vector(sum + 1, 0)); + for (int i = 1; i <= N; ++i) + { + for (int j = 0; j <= sum; ++j) + { + if (j - c[i] >= 0) + { + dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - c[i]] + m[i]); + } + dp[i][j] = max(dp[i - 1][j], dp[i][j]); + } + } + for (int j = 0; j <= sum; ++j) + { + if (dp[N][j] >= M) + { + printf("%d", j); + break; + } + } +} \ No newline at end of file From 70e77abbabfb09fb4d0a1d638ea9720463eb1497 Mon Sep 17 00:00:00 2001 From: MIN-JU-CHO <60171052+MIN-JU-CHO@users.noreply.github.com> Date: Mon, 19 Feb 2024 19:30:50 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=EC=95=B1=207579=20-=20=ED=8C=8C=EC=9D=B4?= =?UTF-8?q?=EC=8D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MinjuCho/7579.py" | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 "Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/7579.py" diff --git "a/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/7579.py" "b/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/7579.py" new file mode 100644 index 0000000..07ca94b --- /dev/null +++ "b/Baekjoon/\353\217\231\354\240\201 \352\263\204\355\232\215\353\262\2252/MinjuCho/7579.py" @@ -0,0 +1,16 @@ +import sys +input = sys.stdin.readline +N, M = map(int, input().strip().split()) +m = list(map(int, input().strip().split())) +c = list(map(int, input().strip().split())) +s = sum(c) +dp = [[0 for _ in range(s+1)] for __ in range(N)] +for i in range(N): + for j in range(s+1): + if j - c[i] >= 0: + dp[i][j] = max(dp[i-1][j], dp[i-1][j-c[i]] + m[i]) + dp[i][j] = max(dp[i][j], dp[i-1][j]) +for j in range(s+1): + if dp[N-1][j] >= M: + print(j) + break From 1b8c660f1598516da808ce19db768d9a20a13a02 Mon Sep 17 00:00:00 2001 From: MIN-JU-CHO <60171052+MIN-JU-CHO@users.noreply.github.com> Date: Mon, 19 Feb 2024 22:37:58 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=EA=B0=80=EC=9E=A5=20=EB=A7=8E=EC=9D=B4=20?= =?UTF-8?q?=EB=B0=9B=EC=9D=80=20=EC=84=A0=EB=AC=BC=20=EC=B9=B4=EC=B9=B4?= =?UTF-8?q?=EC=98=A41=EB=B2=88=20-=20C++?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MinjuCho/kakao_1.cpp | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Programmers/2024 KAKAO WINTER INTERSHIP/MinjuCho/kakao_1.cpp diff --git a/Programmers/2024 KAKAO WINTER INTERSHIP/MinjuCho/kakao_1.cpp b/Programmers/2024 KAKAO WINTER INTERSHIP/MinjuCho/kakao_1.cpp new file mode 100644 index 0000000..66e4e05 --- /dev/null +++ b/Programmers/2024 KAKAO WINTER INTERSHIP/MinjuCho/kakao_1.cpp @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include + +using namespace std; + +int solution(vector friends, vector gifts) { + map> info; + map points; + for (auto elem : gifts) + { + stringstream ss(elem); + ss.str(elem); + string give, receive; + ss >> give; + ss >> receive; + ++points[give]; + --points[receive]; + ++info[give][receive]; + } + map result; + for (int i = 0; i < friends.size(); ++i) + { + string frnd = friends[i]; + for (int j = i + 1; j < friends.size(); ++j) + { + string with = friends[j]; + if (frnd == with) + { + continue; + } + if (info[frnd][with] > info[with][frnd]) + { + ++result[frnd]; + } + else if (info[frnd][with] < info[with][frnd]) + { + ++result[with]; + } + else + { + if (points[frnd] > points[with]) + { + ++result[frnd]; + } + else if (points[frnd] < points[with]) + { + ++result[with]; + } + } + } + } + int answer = 0; + for (auto elem : result) + { + if (elem.second > answer) + { + answer = elem.second; + } + } + return answer; +} + +int main(void) +{ + vector friends = { "muzi", "ryan", "frodo", "neo" }, + gifts = { "muzi frodo", "muzi frodo", "ryan muzi", "ryan muzi", "ryan muzi", + "frodo muzi", "frodo ryan", "neo muzi" }; + printf("%d", solution(friends, gifts)); +} \ No newline at end of file