From ee537f783914a7d338b5fe5825498983859793ed Mon Sep 17 00:00:00 2001 From: caucsejunseo Date: Wed, 7 May 2025 22:49:03 +0900 Subject: [PATCH 1/7] Update README.md --- caucsejunseo/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/caucsejunseo/README.md b/caucsejunseo/README.md index 2267737..541c001 100644 --- a/caucsejunseo/README.md +++ b/caucsejunseo/README.md @@ -9,4 +9,11 @@ | 5차시 | 2025.04.02 | 큐 | [요세푸스문제](https://www.acmicpc.net/problem/1158)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/19| | 6차시 | 2025.04.06 | 큐 | [앵무새](https://www.acmicpc.net/problem/14713)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/23| | 7차시 | 2025.04.10 | 그리디 | [폴리오미노](https://www.acmicpc.net/problem/1343)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/28| +<<<<<<< Updated upstream | 8차시 | 2025.04.11 | 연결리스트| [키로거](https://www.acmicpc.net/problem/5397)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/30| +======= +| 8차시 | 2025.04.11 | 연결리스트| [키로거](https://www.acmicpc.net/problem/5397)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/30| +| 9차시 | 2025.04.30 | 문자열 | [듣보잡](https://www.acmicpc.net/problem/1764)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/35| +|10차시| 2025.05.05 | DP | [1로만들기](https://www.acmicpc.net/problem/1463)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/38| +|11차시| 2025.05.07 | DP | [1,2,3더하기](https://www.acmicpc.net/problem/9095)|| +>>>>>>> Stashed changes From 25047d0858f638e3a2ca098f1c82cd500b13e6b4 Mon Sep 17 00:00:00 2001 From: caucsejunseo Date: Wed, 7 May 2025 22:49:10 +0900 Subject: [PATCH 2/7] =?UTF-8?q?Create=202025.05.05.1=EB=A1=9C=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EA=B8=B0.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...234\353\247\214\353\223\244\352\270\260.c" | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 "caucsejunseo/\353\213\244\354\235\264\353\202\230\353\257\271 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215(dp)/2025.05.05.1\353\241\234\353\247\214\353\223\244\352\270\260.c" diff --git "a/caucsejunseo/\353\213\244\354\235\264\353\202\230\353\257\271 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215(dp)/2025.05.05.1\353\241\234\353\247\214\353\223\244\352\270\260.c" "b/caucsejunseo/\353\213\244\354\235\264\353\202\230\353\257\271 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215(dp)/2025.05.05.1\353\241\234\353\247\214\353\223\244\352\270\260.c" new file mode 100644 index 0000000..1efa687 --- /dev/null +++ "b/caucsejunseo/\353\213\244\354\235\264\353\202\230\353\257\271 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215(dp)/2025.05.05.1\353\241\234\353\247\214\353\223\244\352\270\260.c" @@ -0,0 +1,39 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX 1000001 + + +int main() { + + int N = 0; + scanf("%d", &N); + + int* dp = (int*)malloc(sizeof(int) * MAX); + + if (dp == NULL) { + printf("메모리 할당 실패!\n"); + return 1; + } + + dp[1] = 0; + + for (int i = 2; i < N + 1; i++) + { + dp[i] = dp[i - 1] + 1; + + if (i % 3 == 0) + { + dp[i] = MIN(dp[i], dp[i / 3] + 1); + } + if (i % 2 == 0) + { + dp[i] = MIN(dp[i], dp[i / 2] + 1); + } + } + + printf("%d", dp[N]); + + return 0; +} From 403941922e26128fb294e4acebf9a94a6f333769 Mon Sep 17 00:00:00 2001 From: caucsejunseo Date: Wed, 7 May 2025 22:49:15 +0900 Subject: [PATCH 3/7] =?UTF-8?q?Create=202025.05.07.1,2,3=EB=8D=94=ED=95=98?= =?UTF-8?q?=EA=B8=B0.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2,3\353\215\224\355\225\230\352\270\260.c" | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 "caucsejunseo/\353\213\244\354\235\264\353\202\230\353\257\271 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215(dp)/2025.05.07.1,2,3\353\215\224\355\225\230\352\270\260.c" diff --git "a/caucsejunseo/\353\213\244\354\235\264\353\202\230\353\257\271 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215(dp)/2025.05.07.1,2,3\353\215\224\355\225\230\352\270\260.c" "b/caucsejunseo/\353\213\244\354\235\264\353\202\230\353\257\271 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215(dp)/2025.05.07.1,2,3\353\215\224\355\225\230\352\270\260.c" new file mode 100644 index 0000000..f3b7f02 --- /dev/null +++ "b/caucsejunseo/\353\213\244\354\235\264\353\202\230\353\257\271 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215(dp)/2025.05.07.1,2,3\353\215\224\355\225\230\352\270\260.c" @@ -0,0 +1,115 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +#include + +int main() +{ + int T = 0; + scanf("%d", &T); + + int dp[11]; + + dp[1] = 1; + dp[2] = 2; + dp[3] = 4; + + int* count = (int*)malloc(sizeof(int) * T); + int* answer = (int*)malloc(sizeof(int) * T); + + for (int i = 0; i < T; i++) + { + //값을 넘겨야 해서 &쓰기 + scanf("%d", &count[i]); + + if (count[i] < 4) + { + answer[i] = dp[count[i]]; + } + else if (count[i] >= 4) + { + for (int k = 4; k <= count[i]; k++) + { + dp[k] = dp[k - 1] + dp[k - 2] + dp[k - 3]; + } + answer[i] = dp[count[i]]; + } + } + + for (int i = 0; i < T; i++) + { + printf("%d\n", answer[i]); + } + + + + return 0; +} +/* 1 +* 노가다 + 1 + 1 + + 2 + 1 1 + 2 + + 3 + 1 1 1 + 1 2 + 2 1 + 3 + + 4 + 1 1 1 1 + 1 1 2 + 1 2 1 + 2 1 1 + 2 2 + 1 3 + 3 1 + + 5 + 1 1 1 1 1 + 1 1 1 2 + 1 1 2 1 + 1 2 1 1 + 2 1 1 1 + 1 2 2 + 2 1 2 + 2 2 1 + 1 1 3 + 1 3 1 + 3 1 1 + 2 3 + 3 2 + + 6 + 1 1 1 1 1 1 + 1 1 1 1 2 + 1 1 1 2 1 + 1 1 2 1 1 + 1 2 1 1 1 + 2 1 1 1 1 + 1 1 2 2 + 1 2 1 2 + 1 2 2 1 + 2 1 1 2 + 2 1 2 1 + 2 2 1 1 + 2 2 2 + 1 1 1 3 + 1 1 3 1 + 1 3 1 1 + 3 1 1 1 + 1 2 3 + 1 3 2 + 2 1 3 + 2 3 1 + 3 1 2 + 3 2 1 + 3 3 + + + 1 2 4 7 13 24*/ \ No newline at end of file From 4645eef96621dee8ef9a91fa22f4b44b3c9374d6 Mon Sep 17 00:00:00 2001 From: caucsejunseo Date: Wed, 7 May 2025 22:51:10 +0900 Subject: [PATCH 4/7] Update README.md --- caucsejunseo/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/caucsejunseo/README.md b/caucsejunseo/README.md index 541c001..9c24cff 100644 --- a/caucsejunseo/README.md +++ b/caucsejunseo/README.md @@ -9,11 +9,7 @@ | 5차시 | 2025.04.02 | 큐 | [요세푸스문제](https://www.acmicpc.net/problem/1158)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/19| | 6차시 | 2025.04.06 | 큐 | [앵무새](https://www.acmicpc.net/problem/14713)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/23| | 7차시 | 2025.04.10 | 그리디 | [폴리오미노](https://www.acmicpc.net/problem/1343)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/28| -<<<<<<< Updated upstream - | 8차시 | 2025.04.11 | 연결리스트| [키로거](https://www.acmicpc.net/problem/5397)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/30| -======= | 8차시 | 2025.04.11 | 연결리스트| [키로거](https://www.acmicpc.net/problem/5397)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/30| | 9차시 | 2025.04.30 | 문자열 | [듣보잡](https://www.acmicpc.net/problem/1764)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/35| |10차시| 2025.05.05 | DP | [1로만들기](https://www.acmicpc.net/problem/1463)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/38| |11차시| 2025.05.07 | DP | [1,2,3더하기](https://www.acmicpc.net/problem/9095)|| ->>>>>>> Stashed changes From 62878e7a54636c2ded915d399fb9e7935e99c14b Mon Sep 17 00:00:00 2001 From: caucsejunseo Date: Wed, 7 May 2025 22:51:57 +0900 Subject: [PATCH 5/7] Update README.md --- caucsejunseo/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/caucsejunseo/README.md b/caucsejunseo/README.md index 9c24cff..5517a2e 100644 --- a/caucsejunseo/README.md +++ b/caucsejunseo/README.md @@ -13,3 +13,4 @@ | 9차시 | 2025.04.30 | 문자열 | [듣보잡](https://www.acmicpc.net/problem/1764)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/35| |10차시| 2025.05.05 | DP | [1로만들기](https://www.acmicpc.net/problem/1463)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/38| |11차시| 2025.05.07 | DP | [1,2,3더하기](https://www.acmicpc.net/problem/9095)|| + From 3bcff5b3cf2c2f5588a7246610005641f5f81bad Mon Sep 17 00:00:00 2001 From: caucsejunseo Date: Wed, 7 May 2025 22:52:50 +0900 Subject: [PATCH 6/7] Update README.md --- caucsejunseo/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/caucsejunseo/README.md b/caucsejunseo/README.md index 5517a2e..65de580 100644 --- a/caucsejunseo/README.md +++ b/caucsejunseo/README.md @@ -12,5 +12,9 @@ | 8차시 | 2025.04.11 | 연결리스트| [키로거](https://www.acmicpc.net/problem/5397)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/30| | 9차시 | 2025.04.30 | 문자열 | [듣보잡](https://www.acmicpc.net/problem/1764)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/35| |10차시| 2025.05.05 | DP | [1로만들기](https://www.acmicpc.net/problem/1463)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/38| +<<<<<<< Updated upstream |11차시| 2025.05.07 | DP | [1,2,3더하기](https://www.acmicpc.net/problem/9095)|| +======= +|11차시| 2025.05.07 | DP | [1,2,3더하기](https://www.acmicpc.net/problem/9095)|| +>>>>>>> Stashed changes From f1ed3a0e012bc360bad5a0aa2b7b101ec5b94acf Mon Sep 17 00:00:00 2001 From: caucsejunseo Date: Wed, 7 May 2025 23:23:21 +0900 Subject: [PATCH 7/7] Update README.md --- caucsejunseo/README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/caucsejunseo/README.md b/caucsejunseo/README.md index 65de580..e382a1e 100644 --- a/caucsejunseo/README.md +++ b/caucsejunseo/README.md @@ -12,9 +12,6 @@ | 8차시 | 2025.04.11 | 연결리스트| [키로거](https://www.acmicpc.net/problem/5397)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/30| | 9차시 | 2025.04.30 | 문자열 | [듣보잡](https://www.acmicpc.net/problem/1764)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/35| |10차시| 2025.05.05 | DP | [1로만들기](https://www.acmicpc.net/problem/1463)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/38| -<<<<<<< Updated upstream -|11차시| 2025.05.07 | DP | [1,2,3더하기](https://www.acmicpc.net/problem/9095)|| +|11차시| 2025.05.07 | DP | [1,2,3더하기](https://www.acmicpc.net/problem/9095)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/41| + -======= -|11차시| 2025.05.07 | DP | [1,2,3더하기](https://www.acmicpc.net/problem/9095)|| ->>>>>>> Stashed changes