From 5f0f77d523c21187025e3ee81f4a5edff395be7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Mon, 25 Mar 2024 20:22:47 +0900 Subject: [PATCH 01/48] =?UTF-8?q?2023-03-25=20=EC=B2=B4=EC=9C=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suhyun113/README.md | 4 ++-- .../1-suhyun113.py" | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 "suhyun113/\352\267\270\353\246\254\353\224\224/1-suhyun113.py" diff --git a/suhyun113/README.md b/suhyun113/README.md index a2c6ea2..810c4bc 100644 --- a/suhyun113/README.md +++ b/suhyun113/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.02.12 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/5) | ---- +| 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/5) | +--- \ No newline at end of file diff --git "a/suhyun113/\352\267\270\353\246\254\353\224\224/1-suhyun113.py" "b/suhyun113/\352\267\270\353\246\254\353\224\224/1-suhyun113.py" new file mode 100644 index 0000000..5e3c04c --- /dev/null +++ "b/suhyun113/\352\267\270\353\246\254\353\224\224/1-suhyun113.py" @@ -0,0 +1,17 @@ +def solution(n, lost, reserve): + answer = 0 + + # 여벌 체육복 가져온 학생이 체육복을 도난 당한 경우 제외 + re = list(set(reserve) - set(lost)) + lo = list(set(lost) - set(reserve)) + + # 체육복 빌려주기 + for i in re: + if i-1 in lo: # 앞번호 학생에게 체육복 빌려줌 + lo.remove(i-1) + elif i+1 in lo: # 앞번호 학생이 체육복 있으므로, 뒷번호 학생에게 체육복 빌려줌 + lo.remove(i+1) + + answer = n - len(lo) + + return answer \ No newline at end of file From fa01adf662f96706a2b4f6a7f73ee412fbbb8963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Mon, 25 Mar 2024 21:01:25 +0900 Subject: [PATCH 02/48] =?UTF-8?q?2023-03-25=20=EC=B2=B4=EC=9C=A1=EB=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\352\267\270\353\246\254\353\224\224/1-suhyun113.py" | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git "a/suhyun113/\352\267\270\353\246\254\353\224\224/1-suhyun113.py" "b/suhyun113/\352\267\270\353\246\254\353\224\224/1-suhyun113.py" index 5e3c04c..7a2333d 100644 --- "a/suhyun113/\352\267\270\353\246\254\353\224\224/1-suhyun113.py" +++ "b/suhyun113/\352\267\270\353\246\254\353\224\224/1-suhyun113.py" @@ -1,17 +1,14 @@ def solution(n, lost, reserve): answer = 0 - # 여벌 체육복 가져온 학생이 체육복을 도난 당한 경우 제외 re = list(set(reserve) - set(lost)) lo = list(set(lost) - set(reserve)) - # 체육복 빌려주기 for i in re: - if i-1 in lo: # 앞번호 학생에게 체육복 빌려줌 + if i-1 in lo: lo.remove(i-1) - elif i+1 in lo: # 앞번호 학생이 체육복 있으므로, 뒷번호 학생에게 체육복 빌려줌 + elif i+1 in lo: lo.remove(i+1) answer = n - len(lo) - return answer \ No newline at end of file From 3a06fc43f26c0dcf7db81c30e29d7ee4d5b06332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Mon, 25 Mar 2024 22:55:27 +0900 Subject: [PATCH 03/48] Update README.md --- suhyun113/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suhyun113/README.md b/suhyun113/README.md index 810c4bc..78e2eed 100644 --- a/suhyun113/README.md +++ b/suhyun113/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/5) | +| 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) | --- \ No newline at end of file From 742d5ab4e6eb6c7f0da450d4a53493740c867333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <202230418@pukyong.ac.kr> Date: Mon, 25 Mar 2024 22:55:39 +0900 Subject: [PATCH 04/48] =?UTF-8?q?Create=20=ED=8F=89=EB=B2=94=ED=95=9C=20?= =?UTF-8?q?=EB=B0=B0=EB=82=AD.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2024-03-24 + 평범한 배낭 --- ...4\355\225\234 \353\260\260\353\202\255.py" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "pu2rile/\353\217\231\354\240\201 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215/\355\217\211\353\262\224\355\225\234 \353\260\260\353\202\255.py" diff --git "a/pu2rile/\353\217\231\354\240\201 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215/\355\217\211\353\262\224\355\225\234 \353\260\260\353\202\255.py" "b/pu2rile/\353\217\231\354\240\201 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215/\355\217\211\353\262\224\355\225\234 \353\260\260\353\202\255.py" new file mode 100644 index 0000000..e3609e8 --- /dev/null +++ "b/pu2rile/\353\217\231\354\240\201 \355\224\204\353\241\234\352\267\270\353\236\230\353\260\215/\355\217\211\353\262\224\355\225\234 \353\260\260\353\202\255.py" @@ -0,0 +1,22 @@ +N, K = map(int, input().split()) #입력으로 주어지는 수는 모두 정수 +item = [[0,0]] +bag = [[0 for _ in range(K + 1)] for _ in range(N + 1)] +#가로 - 가방 1~K까지의 무게, 세로 - 물건 N개의 개수로 이루어진 2차원 배열 + +for _ in range(N): #물건의 최대 개수(N)만큼 입력 + item.append(list(map(int, input().split()))) + + +#알고리즘 +for i in range(1, N + 1): #물건 + for j in range(1, K + 1): #최대 무게 + w = item[i][0] + v = item[i][1] + + if j < w: + bag[i][j] = bag[i - 1][j] #w(eight)보다 작으면 위의 값을 그대로 가져옴 + else: + bag[i][j] = max(v + bag[i - 1][j - w], bag[i - 1][j]) + #bag[i][j] = max(현재 물건 가치 + bag[이전 물건][현재 가방 무게-현재 물건 무게], bag[이전 물건][현재 가방 무게]) + +print(bag[N][K]) \ No newline at end of file From 99ec61b418b6be26d37e2c81b67e841b8ea83ae4 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Tue, 26 Mar 2024 10:05:53 +0900 Subject: [PATCH 05/48] =?UTF-8?q?2024-03-26=20=ED=9B=84=EC=9C=84=ED=91=9C?= =?UTF-8?q?=EA=B8=B0=EC=8B=9D2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 2 +- "oesnuj/\354\212\244\355\203\235/1935.cpp" | 43 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 "oesnuj/\354\212\244\355\203\235/1935.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index 8134ba4..9132b27 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2023.10.27 | BFS | - | - | +| 1차시 | 2024.03.26 | 스택 | https://www.acmicpc.net/problem/1935 | https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4 | --- diff --git "a/oesnuj/\354\212\244\355\203\235/1935.cpp" "b/oesnuj/\354\212\244\355\203\235/1935.cpp" new file mode 100644 index 0000000..f5556bb --- /dev/null +++ "b/oesnuj/\354\212\244\355\203\235/1935.cpp" @@ -0,0 +1,43 @@ +#include +#include +#include +#include +using namespace std; + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(NULL); + stack s; + + int n; + cin >> n; + string postfix; + cin >> postfix; + double arr[26] = {0}; + for (int i = 0; i < n; i++) //알파벳에 해당하는 값 저장해놓기 + cin >> arr[i]; + + for (int i = 0; i < postfix.length(); i++) + { + if (postfix[i] >= 'A' && postfix[i] <= 'Z') //피연산자라면 해당 값 push + s.push(arr[postfix[i] - 'A']); + + else //연산자를 만난다면 스택의 top 2개를 꺼내어 연산 수행후 해당 값 push + { + double op1 = s.top(); + s.pop(); + double op2 = s.top(); + s.pop(); + if (postfix[i] == '+') + s.push(op2 + op1); + else if (postfix[i] == '-') + s.push(op2 - op1); + else if (postfix[i] == '*') + s.push(op2 * op1); + else if (postfix[i] == '/') + s.push(op2 / op1); + } + } + cout << fixed << setprecision(2) << s.top(); //소수점 둘째짜리 까지 출력 + return 0; +} \ No newline at end of file From 03c9d138c0d9e32f408b1011c2f7bf94e11f4f8d Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Tue, 26 Mar 2024 10:16:53 +0900 Subject: [PATCH 06/48] Update README.md --- oesnuj/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oesnuj/README.md b/oesnuj/README.md index 9132b27..1d81fdf 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.03.26 | 스택 | https://www.acmicpc.net/problem/1935 | https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4 | +| 1차시 | 2024.03.26 | 스택 | [후위표기식2]https://www.acmicpc.net/problem/1935 | [#4]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4 | --- From f4d6e3fe14585a2e8d6403112d7307283b554cb6 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Tue, 26 Mar 2024 14:42:39 +0900 Subject: [PATCH 07/48] Update 1935.cpp --- "oesnuj/\354\212\244\355\203\235/1935.cpp" | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git "a/oesnuj/\354\212\244\355\203\235/1935.cpp" "b/oesnuj/\354\212\244\355\203\235/1935.cpp" index f5556bb..bb5c447 100644 --- "a/oesnuj/\354\212\244\355\203\235/1935.cpp" +++ "b/oesnuj/\354\212\244\355\203\235/1935.cpp" @@ -13,14 +13,14 @@ int main() cin >> n; string postfix; cin >> postfix; - double arr[26] = {0}; - for (int i = 0; i < n; i++) //알파벳에 해당하는 값 저장해놓기 - cin >> arr[i]; + double alphabet[26] = {0}; + for (int i = 0; i < n; i++) //피연산자(알파벳)에 대응되는 값 저장해놓기 + cin >> alphabet[i]; for (int i = 0; i < postfix.length(); i++) { if (postfix[i] >= 'A' && postfix[i] <= 'Z') //피연산자라면 해당 값 push - s.push(arr[postfix[i] - 'A']); + s.push(alphabet[postfix[i] - 'A']); else //연산자를 만난다면 스택의 top 2개를 꺼내어 연산 수행후 해당 값 push { From 7c6be0b11d8ba215a5ff53b62ca57df7523337ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=ED=99=8D=EA=B5=AC?= Date: Tue, 26 Mar 2024 20:18:52 +0900 Subject: [PATCH 08/48] =?UTF-8?q?2024-03-26=20=EB=B6=84=EC=88=98=EC=9D=98?= =?UTF-8?q?=20=EB=8D=A7=EC=85=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\354\235\230 \353\215\247\354\205\210.js" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "honggukang0623/\354\202\254\354\271\231\354\227\260\354\202\260/\353\266\204\354\210\230\354\235\230 \353\215\247\354\205\210.js" diff --git "a/honggukang0623/\354\202\254\354\271\231\354\227\260\354\202\260/\353\266\204\354\210\230\354\235\230 \353\215\247\354\205\210.js" "b/honggukang0623/\354\202\254\354\271\231\354\227\260\354\202\260/\353\266\204\354\210\230\354\235\230 \353\215\247\354\205\210.js" new file mode 100644 index 0000000..31139b2 --- /dev/null +++ "b/honggukang0623/\354\202\254\354\271\231\354\227\260\354\202\260/\353\266\204\354\210\230\354\235\230 \353\215\247\354\205\210.js" @@ -0,0 +1,22 @@ +function solution(numer1, denom1, numer2, denom2) { + var answer = []; + const numer = numer1 * denom2 + numer2 * denom1; + const denom = denom1 * denom2; + + let minNumber; + if(numer < denom){ + minNumber = numer; + } else { + minNumber = denom; + } + + + while(true){ + if(numer % minNumber === 0){ + if(denom % minNumber === 0){ + return [numer / minNumber, denom / minNumber]; + } + } + minNumber = minNumber -1; + } +} \ No newline at end of file From 461b0a0d304d84e8f98d1bd6c4b4b4a517bb41f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=ED=99=8D=EA=B5=AC?= Date: Tue, 26 Mar 2024 21:49:26 +0900 Subject: [PATCH 09/48] Update README.md --- honggukang0623/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/honggukang0623/README.md b/honggukang0623/README.md index 8134ba4..b8dd9b9 100644 --- a/honggukang0623/README.md +++ b/honggukang0623/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2023.10.27 | BFS | - | - | ---- +| 1차시 | 2024.03.26 | 사칙연산 |[분수의덧셈]https://school.programmers.co.kr/learn/courses/30/lessons/120808 | [#5]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/5 | + From af9aec0116356dd6c128a013f6ada8be546d24b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <202230418@pukyong.ac.kr> Date: Fri, 29 Mar 2024 17:36:41 +0900 Subject: [PATCH 10/48] =?UTF-8?q?2024-03-29=20OX=ED=80=B4=EC=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OX\355\200\264\354\246\210.py" | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 "pu2rile/\352\265\254\355\230\204/OX\355\200\264\354\246\210.py" diff --git "a/pu2rile/\352\265\254\355\230\204/OX\355\200\264\354\246\210.py" "b/pu2rile/\352\265\254\355\230\204/OX\355\200\264\354\246\210.py" new file mode 100644 index 0000000..d72cf8c --- /dev/null +++ "b/pu2rile/\352\265\254\355\230\204/OX\355\200\264\354\246\210.py" @@ -0,0 +1,12 @@ +n = int(input()) +for _ in range(n): + test = list(input()) + score = 0 + sum_score = 0 #새로운 태스트를 입력받으면 점수 리셋 + for ox in test: + if ox == 'O': + score += 1 #'O'가 연속되면 점수가 1점씩 추가 + sum_score += score + else: + score = 0 + print(sum_score) \ No newline at end of file From 709820a2d8793f01fcd1e33986d7114ec2ad719e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <163822282+pu2rile@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:38:55 +0900 Subject: [PATCH 11/48] Update README.md --- pu2rile/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pu2rile/README.md b/pu2rile/README.md index cbf357a..c9d604c 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -3,4 +3,4 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.03.24 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/3#issue-2205834078)| -| 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/3#issue-2205834078)| +| 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/6#issue-2214931034)| From 1ebc5642a875b11435a8ab12a8ddbd7b152cfa85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=ED=99=8D=EA=B5=AC?= Date: Fri, 29 Mar 2024 23:12:04 +0900 Subject: [PATCH 12/48] =?UTF-8?q?2024-03-29=20=EB=B0=B0=EC=97=B4=20?= =?UTF-8?q?=EB=91=90=EB=B0=B0=20=EB=A7=8C=EB=93=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3\260\260 \353\247\214\353\223\244\352\270\260.js" | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 "honggukang0623/\353\260\260\354\227\264/\353\260\260\354\227\264 \353\221\220\353\260\260 \353\247\214\353\223\244\352\270\260.js" diff --git "a/honggukang0623/\353\260\260\354\227\264/\353\260\260\354\227\264 \353\221\220\353\260\260 \353\247\214\353\223\244\352\270\260.js" "b/honggukang0623/\353\260\260\354\227\264/\353\260\260\354\227\264 \353\221\220\353\260\260 \353\247\214\353\223\244\352\270\260.js" new file mode 100644 index 0000000..c574b50 --- /dev/null +++ "b/honggukang0623/\353\260\260\354\227\264/\353\260\260\354\227\264 \353\221\220\353\260\260 \353\247\214\353\223\244\352\270\260.js" @@ -0,0 +1,11 @@ +function solution(numbers) { + var answer = []; + + + let cnt = 0; + while(cnt < numbers.length){ + answer.push(numbers[cnt]*2); + cnt = cnt +1; + } + return answer; +} \ No newline at end of file From 686be267d706479671b5796caad86ac65b2f54f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=ED=99=8D=EA=B5=AC?= Date: Fri, 29 Mar 2024 23:36:58 +0900 Subject: [PATCH 13/48] =?UTF-8?q?2024-03-29=20=EB=B0=B0=EC=97=B4=EC=9D=98?= =?UTF-8?q?=20=EB=91=90=EB=B0=B0=20=EB=A7=8C=EB=93=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- honggukang0623/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/honggukang0623/README.md b/honggukang0623/README.md index 8134ba4..a31df9a 100644 --- a/honggukang0623/README.md +++ b/honggukang0623/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2023.10.27 | BFS | - | - | ---- +| 1차시 | 2024.03.26 | 사칙연산 |[분수의덧셈]https://school.programmers.co.kr/learn/courses/30/lessons/120808 | [#5]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/5 | +| 2차시 | 2024.03.29 | 배열 |[배열두배만들기]https://school.programmers.co.kr/learn/courses/30/lessons/120809 | [#7]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/7 | From b092e7ea6e3123e39fa64093f9fcc0437ada5d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=9C=20Junseo=20Kim?= Date: Fri, 29 Mar 2024 23:53:04 +0900 Subject: [PATCH 14/48] Update README.md --- oesnuj/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oesnuj/README.md b/oesnuj/README.md index 1d81fdf..cfd49b6 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.03.26 | 스택 | [후위표기식2]https://www.acmicpc.net/problem/1935 | [#4]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4 | +| 1차시 | 2024.03.26 | 스택 | [후위표기식2]h(ttps://www.acmicpc.net/problem/1935) | [#4](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4) | --- From 8bafb48057fee725ef081ddf534e2258a10da9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=9C=20Junseo=20Kim?= Date: Fri, 29 Mar 2024 23:53:19 +0900 Subject: [PATCH 15/48] Update README.md --- oesnuj/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oesnuj/README.md b/oesnuj/README.md index cfd49b6..b2825e1 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.03.26 | 스택 | [후위표기식2]h(ttps://www.acmicpc.net/problem/1935) | [#4](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4) | +| 1차시 | 2024.03.26 | 스택 | [후위표기식2](https://www.acmicpc.net/problem/1935) | [#4](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4) | --- From 18493c70780cf2e22b695ff6d30b02ec507c072d Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Sat, 30 Mar 2024 00:04:02 +0900 Subject: [PATCH 16/48] =?UTF-8?q?2024-03-29=20=EC=97=90=EB=94=94=ED=84=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 1 + .../1406.cpp" | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 "oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index b2825e1..1f828ae 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -3,4 +3,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.03.26 | 스택 | [후위표기식2](https://www.acmicpc.net/problem/1935) | [#4](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4) | +| 2차시 | 2024.03.29 | 연결리스트 | [에디터](https://www.acmicpc.net/problem/1406) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/8) | --- diff --git "a/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" "b/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" new file mode 100644 index 0000000..b22d015 --- /dev/null +++ "b/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" @@ -0,0 +1,50 @@ +#include +#include +using namespace std; +int main() +{ + ios::sync_with_stdio(0); cin.tie(0); + list li; //양방향 연결리스트 선언 + string str; + cin >> str; + for (auto c : str) //한 문자씩 연결리스트에 넣기 + li.push_back(c); + + list::iterator it = li.end(); + int t; + cin >> t; + while(t--) + { + char input; + cin >> input; + if (input == 'L') + { + if (it != li.begin()) + it--; + } + else if (input == 'D') + { + if (it != li.end()) + it++; + } + else if (input == 'B') + { + if (it != li.begin()) + { + it--; + it = li.erase(it); + } + } + else if (input == 'P') + { + char insertChar; + cin >> insertChar; + it = li.insert(it, insertChar); + it++; + } + } + + for (auto c : li) + cout << c; + return 0; +} \ No newline at end of file From 6034aae923377d4f954937d6ebd22fa594092fd8 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Sat, 30 Mar 2024 00:56:44 +0900 Subject: [PATCH 17/48] Update 1406.cpp --- .../1406.cpp" | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git "a/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" "b/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" index b22d015..fce2a9c 100644 --- "a/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" +++ "b/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" @@ -39,8 +39,7 @@ int main() { char insertChar; cin >> insertChar; - it = li.insert(it, insertChar); - it++; + li.insert(it, insertChar); } } From e8504f545ed41af725ff329d2b1cb219a1d69bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Sat, 30 Mar 2024 06:21:41 +0900 Subject: [PATCH 18/48] =?UTF-8?q?2023-03-29=20=EC=86=8C=EC=88=98=20&=20?= =?UTF-8?q?=ED=8C=B0=EB=A6=B0=EB=93=9C=EB=A1=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suhyun113/2-suhyun113.py | 22 ++++++++++++++++++++++ suhyun113/README.md | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 suhyun113/2-suhyun113.py diff --git a/suhyun113/2-suhyun113.py b/suhyun113/2-suhyun113.py new file mode 100644 index 0000000..65e7990 --- /dev/null +++ b/suhyun113/2-suhyun113.py @@ -0,0 +1,22 @@ +# 팰린드롬 수 +def is_palindrome(num): + return str(num) == str(num)[::-1] + +# 소수 찾기 +def is_prime_num(n): + if n < 2: + return False # 1은 소수가 아님 + for i in range(2, int(n**0.5) + 1): + if n % i == 0: + return False + return True + +N = int(input()) # 어떤 수 N +# output은 N보다 크거나 같으므로 N으로 초기화 +result = N # 현재 + +while True: # N보다 크거나 같은 수(항상) + if is_prime_num(result) and is_palindrome(result): # 소수이면서 팰린드롬인 수 + print(result) + break + result += 1 \ No newline at end of file diff --git a/suhyun113/README.md b/suhyun113/README.md index a2c6ea2..b78920c 100644 --- a/suhyun113/README.md +++ b/suhyun113/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.02.12 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/5) | ---- +| 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) | +| 2차시 | 2024.03.29 | 수학 | [소수 & 팰린드롬](https://www.acmicpc.net/problem/1747) | [#1](https://github.com/AlgoLeadMe-10/AlgoLeadMe-10/pull/3) | \ No newline at end of file From f5d60551fb5cc191d3c7b2467fd11cd8941d780c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Sun, 31 Mar 2024 16:20:10 +0900 Subject: [PATCH 19/48] =?UTF-8?q?2024-03-29=20=EC=86=8C=EC=88=98=20&=20?= =?UTF-8?q?=ED=8C=B0=EB=A6=B0=EB=93=9C=EB=A1=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\354\210\230\355\225\231/2-suhyun113.py" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename suhyun113/2-suhyun113.py => "suhyun113/\354\210\230\355\225\231/2-suhyun113.py" (100%) diff --git a/suhyun113/2-suhyun113.py "b/suhyun113/\354\210\230\355\225\231/2-suhyun113.py" similarity index 100% rename from suhyun113/2-suhyun113.py rename to "suhyun113/\354\210\230\355\225\231/2-suhyun113.py" From 61dbdeac2c1824eb8ac576ee44481b6e4ef987ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Mon, 1 Apr 2024 20:49:10 +0900 Subject: [PATCH 20/48] Update README.md --- suhyun113/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suhyun113/README.md b/suhyun113/README.md index b78920c..658bbe3 100644 --- a/suhyun113/README.md +++ b/suhyun113/README.md @@ -3,4 +3,4 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) | -| 2차시 | 2024.03.29 | 수학 | [소수 & 팰린드롬](https://www.acmicpc.net/problem/1747) | [#1](https://github.com/AlgoLeadMe-10/AlgoLeadMe-10/pull/3) | \ No newline at end of file +| 2차시 | 2024.03.29 | 수학 | [소수 & 팰린드롬](https://www.acmicpc.net/problem/1747) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) | \ No newline at end of file From 962a22a5194b34e1bdf6153650a317ed47cd5589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <163822282+pu2rile@users.noreply.github.com> Date: Tue, 2 Apr 2024 23:10:38 +0900 Subject: [PATCH 21/48] Update README.md --- pu2rile/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/pu2rile/README.md b/pu2rile/README.md index c9d604c..a99c370 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -4,3 +4,4 @@ |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.03.24 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/3#issue-2205834078)| | 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/6#issue-2214931034)| +| 3차시 | 2024.04.02 | 문자열 | [크로아티아 알파벳](https://www.acmicpc.net/problem/8958) | [#10]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/10#issue-2220631332 From daf1946bd11969fc4fe2f373aa3b1ab2c4b7d646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <163822282+pu2rile@users.noreply.github.com> Date: Tue, 2 Apr 2024 23:11:06 +0900 Subject: [PATCH 22/48] Update README.md --- pu2rile/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pu2rile/README.md b/pu2rile/README.md index a99c370..1a26feb 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -4,4 +4,4 @@ |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.03.24 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/3#issue-2205834078)| | 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/6#issue-2214931034)| -| 3차시 | 2024.04.02 | 문자열 | [크로아티아 알파벳](https://www.acmicpc.net/problem/8958) | [#10]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/10#issue-2220631332 +| 3차시 | 2024.04.02 | 문자열 | [크로아티아 알파벳](https://www.acmicpc.net/problem/8958) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/10#issue-2220631332) From ec065b7314bffb6ff969dd05f5ebe4d745db0969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=9C=20Junseo=20Kim?= Date: Tue, 2 Apr 2024 23:22:31 +0900 Subject: [PATCH 23/48] Update 1406.cpp --- .../1406.cpp" | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git "a/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" "b/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" index fce2a9c..f9b2abb 100644 --- "a/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" +++ "b/oesnuj/\354\227\260\352\262\260\353\246\254\354\212\244\355\212\270/1406.cpp" @@ -10,7 +10,7 @@ int main() for (auto c : str) //한 문자씩 연결리스트에 넣기 li.push_back(c); - list::iterator it = li.end(); + list::iterator cursor = li.end(); int t; cin >> t; while(t--) @@ -19,31 +19,31 @@ int main() cin >> input; if (input == 'L') { - if (it != li.begin()) - it--; + if (cursor != li.begin()) + cursor--; } else if (input == 'D') { - if (it != li.end()) - it++; + if (cursor != li.end()) + cursor++; } else if (input == 'B') { - if (it != li.begin()) + if (cursor != li.begin()) { - it--; - it = li.erase(it); + cursor--; + cursor = li.erase(cursor); } } else if (input == 'P') { char insertChar; cin >> insertChar; - li.insert(it, insertChar); + li.insert(cursor, insertChar); } } for (auto c : li) cout << c; return 0; -} \ No newline at end of file +} From 62cd274212203049af0cd7346b91737b571f20c8 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Tue, 2 Apr 2024 23:27:52 +0900 Subject: [PATCH 24/48] =?UTF-8?q?2024-04-02=20=EC=B9=B4=EB=93=9C=20?= =?UTF-8?q?=EB=86=93=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 1 + "oesnuj/\353\215\261/18115.cpp" | 51 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 "oesnuj/\353\215\261/18115.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index 1f828ae..8b58e8a 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -4,4 +4,5 @@ |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.03.26 | 스택 | [후위표기식2](https://www.acmicpc.net/problem/1935) | [#4](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4) | | 2차시 | 2024.03.29 | 연결리스트 | [에디터](https://www.acmicpc.net/problem/1406) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/8) | +| 3차시 | 2024.04.02 | 덱 | [카드 놓기](https://www.acmicpc.net/problem/18115) | [#11](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/11) | --- diff --git "a/oesnuj/\353\215\261/18115.cpp" "b/oesnuj/\353\215\261/18115.cpp" new file mode 100644 index 0000000..07237b6 --- /dev/null +++ "b/oesnuj/\353\215\261/18115.cpp" @@ -0,0 +1,51 @@ +#include +#include +#include +#include +using namespace std; + + +int main() +{ + ios_base::sync_with_stdio(false); + cin.tie(NULL); + deque d; + vector v; + int n; + cin >> n; + for (int i = 0; i < n; i++) { //규칙 저장하기 : 사용한 순서대로 vector에 넣음 + int num; + cin >> num; + v.push_back(num); + } + vector::reverse_iterator rit = v.rbegin(); //복원시 가장 마지막에 사용한 규칙부터 사용해야하기에 역반복자 사용 + + int card = 1; //다 내려놓은 이후 현재 제일 위의 카드는 1 + for (rit; rit != v.rend(); rit++) { + //규칙 1은 제일 위 카드 1장 바닥에 내려놓기이므로 복원시에는 덱의 가장 위로 옮긴다. + if (*rit == 1) + d.push_back(card); + + + // 규칙 2는 위에 두번째 카드 바닥에 내려놓기이므로 복원시에는 덱의 위에서 두번째로 옮긴다. + else if (*rit == 2) + { + int temp = d.back(); //가장 위의 숫자는 잠깐 빼고 + d.pop_back(); + d.push_back(card); //넣어야할 카드 넣고 + d.push_back(temp); //빼두었던 가장 위의 숫자 다시 넣기 + } + + //규칙 3은 제일 밑의 카드를 바닥으로 내려놓기이므로 복원시에는 덱의 제일 밑으로 옮긴다. + else if (*rit == 3) + d.push_front(card); + + card++; //다음카드를 복원시켜야함(다음카드는 하나 큰 숫자임) + } + + reverse(d.begin(), d.end()); //덱의 요소를 뒤(위)에서 부터 출력해야해 뒤집는다. + for (auto &k : d) { //출력 + cout << k << " "; + } + return 0; +} \ No newline at end of file From e7bad7fdf3ccbf782f68b44742ac71fa0e0c658d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Wed, 3 Apr 2024 22:17:45 +0900 Subject: [PATCH 25/48] =?UTF-8?q?2024-04-02=20=EA=B1=B0=EC=8A=A4=EB=A6=84?= =?UTF-8?q?=EB=8F=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suhyun113/README.md | 5 +++-- .../3-suhyun113.py" | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 "suhyun113/\352\267\270\353\246\254\353\224\224/3-suhyun113.py" diff --git a/suhyun113/README.md b/suhyun113/README.md index 658bbe3..b25f4a7 100644 --- a/suhyun113/README.md +++ b/suhyun113/README.md @@ -2,5 +2,6 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) | -| 2차시 | 2024.03.29 | 수학 | [소수 & 팰린드롬](https://www.acmicpc.net/problem/1747) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) | \ No newline at end of file +| 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) | +| 2차시 | 2024.03.29 | 수학 | [소수 & 팰린드롬](https://www.acmicpc.net/problem/1747) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) | +| 3차시 | 2024.04.02 | 그리디 | [거스름돈](https://www.acmicpc.net/problem/14916) | [#12](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/12) | \ No newline at end of file diff --git "a/suhyun113/\352\267\270\353\246\254\353\224\224/3-suhyun113.py" "b/suhyun113/\352\267\270\353\246\254\353\224\224/3-suhyun113.py" new file mode 100644 index 0000000..88a60dc --- /dev/null +++ "b/suhyun113/\352\267\270\353\246\254\353\224\224/3-suhyun113.py" @@ -0,0 +1,17 @@ +n = int(input()) # 거스름돈 액수 +coin_count = 0 # 동전의 개수 + +while True: # 무한루프 +# 2원보다 5원이 더 큰 값이기 때문에, 동전의 최소 개수를 구할 때 5원부터 판별함 + if n % 5 == 0: # 5로 나누어 떨어지면 5원의 개수가 최소 동전의 개수 + coin_count = n // 5 + break # 최소 동전의 개수이므로 바로 출력 + else: # 5의 배수 아니면, 거스름돈에서 2씩 빼면서 5로 떨어지는 것을 찾음 + n -= 2 + coin_count += 1 # 5로 나눠떨어질 때마다 동전의 개수 증가 + +# 거스름돈에서 2원씩 빼다가 거스름돈이 0보다 작아지면 더 이상 거슬러줄 수 없음 +if (n < 0): + print(-1) +else: + print(coin_count) \ No newline at end of file From 874af29781b298d764a501c1cfc0a5e46dd14222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Wed, 3 Apr 2024 23:15:33 +0900 Subject: [PATCH 26/48] Update 3-suhyun113.py --- .../\352\267\270\353\246\254\353\224\224/3-suhyun113.py" | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git "a/suhyun113/\352\267\270\353\246\254\353\224\224/3-suhyun113.py" "b/suhyun113/\352\267\270\353\246\254\353\224\224/3-suhyun113.py" index 88a60dc..216002b 100644 --- "a/suhyun113/\352\267\270\353\246\254\353\224\224/3-suhyun113.py" +++ "b/suhyun113/\352\267\270\353\246\254\353\224\224/3-suhyun113.py" @@ -1,16 +1,19 @@ n = int(input()) # 거스름돈 액수 coin_count = 0 # 동전의 개수 - +i = 0 while True: # 무한루프 # 2원보다 5원이 더 큰 값이기 때문에, 동전의 최소 개수를 구할 때 5원부터 판별함 if n % 5 == 0: # 5로 나누어 떨어지면 5원의 개수가 최소 동전의 개수 - coin_count = n // 5 + coin_count += n // 5 break # 최소 동전의 개수이므로 바로 출력 else: # 5의 배수 아니면, 거스름돈에서 2씩 빼면서 5로 떨어지는 것을 찾음 n -= 2 coin_count += 1 # 5로 나눠떨어질 때마다 동전의 개수 증가 # 거스름돈에서 2원씩 빼다가 거스름돈이 0보다 작아지면 더 이상 거슬러줄 수 없음 + if (n < 0): + break + if (n < 0): print(-1) else: From 3425bba87dec8af270d8b54a911bec55463609dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=ED=99=8D=EA=B5=AC?= Date: Sat, 6 Apr 2024 06:23:11 +0900 Subject: [PATCH 27/48] =?UTF-8?q?2024-04-05=20=EC=A4=91=EC=95=99=EA=B0=92?= =?UTF-8?q?=20=EA=B5=AC=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...22\352\265\254\355\225\230\352\270\260.js" | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 "honggukang0623/\354\244\221\354\225\231\352\260\222 \352\265\254\355\225\230\352\270\260/\354\244\221\354\225\231\352\260\222\352\265\254\355\225\230\352\270\260.js" diff --git "a/honggukang0623/\354\244\221\354\225\231\352\260\222 \352\265\254\355\225\230\352\270\260/\354\244\221\354\225\231\352\260\222\352\265\254\355\225\230\352\270\260.js" "b/honggukang0623/\354\244\221\354\225\231\352\260\222 \352\265\254\355\225\230\352\270\260/\354\244\221\354\225\231\352\260\222\352\265\254\355\225\230\352\270\260.js" new file mode 100644 index 0000000..15c2f14 --- /dev/null +++ "b/honggukang0623/\354\244\221\354\225\231\352\260\222 \352\265\254\355\225\230\352\270\260/\354\244\221\354\225\231\352\260\222\352\265\254\355\225\230\352\270\260.js" @@ -0,0 +1,30 @@ +function solution(array) { + + let arrayCnt = 0; + let newArray = []; + while(arrayCnt < array.length){ + let minNumber = 1000; + + let cnt = 0; + while(cnt < array.length){ + if(minNumber > array[cnt]){ + minNumber = array[cnt]; + } + cnt = cnt + 1; + } + + newArray.push(minNumber); + + let cnt2 = 0; + while(cnt2 < array.length){ + if(minNumber === array[cnt2]){ + array[cnt] = 1000; + break; + } + cnt2 = cnt2 + 1 + } + + arrayCnt = arrayCnt + 1; + } + return newArray[Math.floor(array.length / 2)]; +} \ No newline at end of file From 8334bf06fb1645fda032de63f511dce79ef70c0d Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Sat, 6 Apr 2024 12:10:14 +0900 Subject: [PATCH 28/48] =?UTF-8?q?2024-04-06=20=EC=98=A5=EC=83=81=20?= =?UTF-8?q?=EC=A0=95=EC=9B=90=20=EA=BE=B8=EB=AF=B8=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 1 + "oesnuj/\354\212\244\355\203\235/6198.cpp" | 44 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 "oesnuj/\354\212\244\355\203\235/6198.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index 8b58e8a..e5d0c1f 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -5,4 +5,5 @@ | 1차시 | 2024.03.26 | 스택 | [후위표기식2](https://www.acmicpc.net/problem/1935) | [#4](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/4) | | 2차시 | 2024.03.29 | 연결리스트 | [에디터](https://www.acmicpc.net/problem/1406) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/8) | | 3차시 | 2024.04.02 | 덱 | [카드 놓기](https://www.acmicpc.net/problem/18115) | [#11](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/11) | +| 4차시 | 2024.04.06 | 스택 | [옥상 정원 꾸미기](https://www.acmicpc.net/problem/6198) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/14) | --- diff --git "a/oesnuj/\354\212\244\355\203\235/6198.cpp" "b/oesnuj/\354\212\244\355\203\235/6198.cpp" new file mode 100644 index 0000000..e7cca65 --- /dev/null +++ "b/oesnuj/\354\212\244\355\203\235/6198.cpp" @@ -0,0 +1,44 @@ +#include +#include + +using namespace std; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + + int n; + cin >> n; //빌딩 개수 입력 + + vector v(n); //빌딩 높이를 받을 벡터 선언 + vector s; //빌딩 높이들을 적절하게 넣을 스택 선언 + for (auto& i : v) + cin >> i; //각 빌딩 높이 입력 + + long long int count = 0; //count가 int형을 넘어서기에 long long int type으로 둠 + for (const auto& height : v) // 모든 빌딩 높이를 하나씩 순회한다. + { + while (true) + { + if (s.empty()) //스택이 비었다면 현재 빌딩 높이 스택에 push + { + s.push_back(height); + break; + } + if (height < s.back()) //현재 빌딩 높이가 스택의 top보다 높은 빌딩이라면(볼 수 있는 빌딩이라면) + { + count += s.size(); + //스택에는 현재 빌딩보다 높은 빌딩 밖에 없으니 스택의 크기 = 현재 빌딩을 볼 수 있는 빌딩 수 + s.push_back(height); + break; + } + s.pop_back(); //현재 빌딩이 스택의 top보다 높다면(어짜피 나를 볼 수 없는 빌딩이니) 전부 pop + //스택이 비거나 현재 빌딩보다 높은 top이 나올때까지 pop한다. + // 언제까지 pop 할까? + //case 1. 스택이 비면 나를 볼 수 있는 빌딩은 없다는 뜻이니 스택에 push + //case 2. 나보다 높은 빌딩이 나온다면 그때 스택의 크기 = 나를 볼 수 있는 빌딩 수 를 count에 추가 + } + } + cout << count; + return 0; +} \ No newline at end of file From 3d8135bec8210a6e7bb106ebb9de9ebaf59124d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <202230418@pukyong.ac.kr> Date: Mon, 8 Apr 2024 03:57:43 +0900 Subject: [PATCH 29/48] =?UTF-8?q?2024-04-08=20=EC=A0=9C=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pu2rile/README.md | 1 + .../\354\240\234\353\241\234.py" | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 "pu2rile/\354\212\244\355\203\235/\354\240\234\353\241\234.py" diff --git a/pu2rile/README.md b/pu2rile/README.md index 1a26feb..58e9799 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -5,3 +5,4 @@ | 1차시 | 2024.03.24 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/3#issue-2205834078)| | 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/6#issue-2214931034)| | 3차시 | 2024.04.02 | 문자열 | [크로아티아 알파벳](https://www.acmicpc.net/problem/8958) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/10#issue-2220631332) +| 4차시 | 2024.04.08 | 스택 | [제로](https://www.acmicpc.net/problem/10773) | [#]() diff --git "a/pu2rile/\354\212\244\355\203\235/\354\240\234\353\241\234.py" "b/pu2rile/\354\212\244\355\203\235/\354\240\234\353\241\234.py" new file mode 100644 index 0000000..f02b9be --- /dev/null +++ "b/pu2rile/\354\212\244\355\203\235/\354\240\234\353\241\234.py" @@ -0,0 +1,9 @@ +k = int(input()) +stack = [] +for _ in range(k): + n = int(input()) + if n == 0: + stack.pop() + else: + stack.append(n) +print(sum(stack)) \ No newline at end of file From e12fa6e76808a67c37e182a1e990695657506fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <163822282+pu2rile@users.noreply.github.com> Date: Mon, 8 Apr 2024 04:11:13 +0900 Subject: [PATCH 30/48] Update README.md --- pu2rile/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pu2rile/README.md b/pu2rile/README.md index 58e9799..f04c429 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -5,4 +5,4 @@ | 1차시 | 2024.03.24 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/3#issue-2205834078)| | 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/6#issue-2214931034)| | 3차시 | 2024.04.02 | 문자열 | [크로아티아 알파벳](https://www.acmicpc.net/problem/8958) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/10#issue-2220631332) -| 4차시 | 2024.04.08 | 스택 | [제로](https://www.acmicpc.net/problem/10773) | [#]() +| 4차시 | 2024.04.08 | 스택 | [제로](https://www.acmicpc.net/problem/10773) | [#15](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/15#issue-2229909173) From b3b69ee390855c04f97f75a3ff8feec3342b9486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <163822282+pu2rile@users.noreply.github.com> Date: Mon, 8 Apr 2024 04:12:32 +0900 Subject: [PATCH 31/48] Update README.md --- pu2rile/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/pu2rile/README.md b/pu2rile/README.md index 1a26feb..f04c429 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -5,3 +5,4 @@ | 1차시 | 2024.03.24 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/3#issue-2205834078)| | 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/6#issue-2214931034)| | 3차시 | 2024.04.02 | 문자열 | [크로아티아 알파벳](https://www.acmicpc.net/problem/8958) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/10#issue-2220631332) +| 4차시 | 2024.04.08 | 스택 | [제로](https://www.acmicpc.net/problem/10773) | [#15](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/15#issue-2229909173) From 4b6cb2d0ef1ee55cdac14b2cb128afd0b3a105ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Mon, 8 Apr 2024 18:52:07 +0900 Subject: [PATCH 32/48] =?UTF-8?q?2024-04-06=20=ED=94=BC=EB=B3=B4=EB=82=98?= =?UTF-8?q?=EC=B9=98=20=EC=88=98=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suhyun113/DP/4-suhyun113.py | 9 +++++++++ suhyun113/README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 suhyun113/DP/4-suhyun113.py diff --git a/suhyun113/DP/4-suhyun113.py b/suhyun113/DP/4-suhyun113.py new file mode 100644 index 0000000..183d20f --- /dev/null +++ b/suhyun113/DP/4-suhyun113.py @@ -0,0 +1,9 @@ +memo = [0, 1] + +n = int(input()) +def fibo(n): + if n >= 2 and n >= len(memo): + memo.append(fibo(n-1)+fibo(n-2)) + return memo[n] + +print(fibo(n)) \ No newline at end of file diff --git a/suhyun113/README.md b/suhyun113/README.md index b25f4a7..f3aaba3 100644 --- a/suhyun113/README.md +++ b/suhyun113/README.md @@ -4,4 +4,5 @@ |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) | | 2차시 | 2024.03.29 | 수학 | [소수 & 팰린드롬](https://www.acmicpc.net/problem/1747) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) | -| 3차시 | 2024.04.02 | 그리디 | [거스름돈](https://www.acmicpc.net/problem/14916) | [#12](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/12) | \ No newline at end of file +| 3차시 | 2024.04.02 | 그리디 | [거스름돈](https://www.acmicpc.net/problem/14916) | [#12](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/12) | +| 4차시 | 2024.04.06 | DP | [피보나치 수 5](https://www.acmicpc.net/problem/10870) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/16) | \ No newline at end of file From a6ba11ea3bf119eb8877528dc152bb28aa5fb1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=ED=99=8D=EA=B5=AC?= Date: Wed, 10 Apr 2024 21:36:49 +0900 Subject: [PATCH 33/48] =?UTF-8?q?2024-04-09=20=EC=A7=81=EA=B0=81=EC=82=BC?= =?UTF-8?q?=EA=B0=81=ED=98=95=20=EC=B6=9C=EB=A0=A5=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- honggukang0623/README.md | 1 + ...34\353\240\245\355\225\230\352\270\260.js" | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 "honggukang0623/\354\247\201\352\260\201\354\202\274\352\260\201\355\230\225 \354\266\234\353\240\245\355\225\230\352\270\260/\354\247\201\352\260\201\354\202\274\352\260\201\355\230\225 \354\266\234\353\240\245\355\225\230\352\270\260.js" diff --git a/honggukang0623/README.md b/honggukang0623/README.md index a31df9a..e12b00b 100644 --- a/honggukang0623/README.md +++ b/honggukang0623/README.md @@ -4,3 +4,4 @@ |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.03.26 | 사칙연산 |[분수의덧셈]https://school.programmers.co.kr/learn/courses/30/lessons/120808 | [#5]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/5 | | 2차시 | 2024.03.29 | 배열 |[배열두배만들기]https://school.programmers.co.kr/learn/courses/30/lessons/120809 | [#7]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/7 | +| 3차시 | 2024.04.05 | 배열 |[중앙값구하기]https://school.programmers.co.kr/learn/courses/30/lessons/120811# | [#13]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/13 | \ No newline at end of file diff --git "a/honggukang0623/\354\247\201\352\260\201\354\202\274\352\260\201\355\230\225 \354\266\234\353\240\245\355\225\230\352\270\260/\354\247\201\352\260\201\354\202\274\352\260\201\355\230\225 \354\266\234\353\240\245\355\225\230\352\270\260.js" "b/honggukang0623/\354\247\201\352\260\201\354\202\274\352\260\201\355\230\225 \354\266\234\353\240\245\355\225\230\352\270\260/\354\247\201\352\260\201\354\202\274\352\260\201\355\230\225 \354\266\234\353\240\245\355\225\230\352\270\260.js" new file mode 100644 index 0000000..0642861 --- /dev/null +++ "b/honggukang0623/\354\247\201\352\260\201\354\202\274\352\260\201\355\230\225 \354\266\234\353\240\245\355\225\230\352\270\260/\354\247\201\352\260\201\354\202\274\352\260\201\355\230\225 \354\266\234\353\240\245\355\225\230\352\270\260.js" @@ -0,0 +1,27 @@ +const readline = require('readline'); +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +let input = []; + +rl.on('line', function (line) { + input = line.split(' '); +}).on('close', function () { + const n = Number(input[0]); + + let line = 1; + while(line <= n){ + + let starStr = ""; + let cnt = 0; + while(cnt < line){ + starStr = starStr+"*" + cnt = cnt + 1; + } + + console.log(starStr) + line = line + 1; + } +}); \ No newline at end of file From 034ac610d9fa28ebcb4a06e4bd0551cb31c77a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Fri, 12 Apr 2024 22:20:47 +0900 Subject: [PATCH 34/48] =?UTF-8?q?2024-04-10=20=ED=81=AC=EB=A0=88=EC=9D=B8?= =?UTF-8?q?=20=EC=9D=B8=ED=98=95=20=EB=BD=91=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suhyun113/README.md | 3 ++- .../\354\212\244\355\203\235/5-suhyun113.py" | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 "suhyun113/\354\212\244\355\203\235/5-suhyun113.py" diff --git a/suhyun113/README.md b/suhyun113/README.md index f3aaba3..d79604f 100644 --- a/suhyun113/README.md +++ b/suhyun113/README.md @@ -5,4 +5,5 @@ | 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) | | 2차시 | 2024.03.29 | 수학 | [소수 & 팰린드롬](https://www.acmicpc.net/problem/1747) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) | | 3차시 | 2024.04.02 | 그리디 | [거스름돈](https://www.acmicpc.net/problem/14916) | [#12](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/12) | -| 4차시 | 2024.04.06 | DP | [피보나치 수 5](https://www.acmicpc.net/problem/10870) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/16) | \ No newline at end of file +| 4차시 | 2024.04.06 | DP | [피보나치 수 5](https://www.acmicpc.net/problem/10870) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/16) | +| 5차시 | 2024.04.10 | 스택 | [크레인 인형 뽑기 게임](https://school.programmers.co.kr/learn/courses/30/lessons/64061) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/19) | \ No newline at end of file diff --git "a/suhyun113/\354\212\244\355\203\235/5-suhyun113.py" "b/suhyun113/\354\212\244\355\203\235/5-suhyun113.py" new file mode 100644 index 0000000..b07a0f8 --- /dev/null +++ "b/suhyun113/\354\212\244\355\203\235/5-suhyun113.py" @@ -0,0 +1,24 @@ +def solution(board, moves): + answer = 0 + basket = [float("inf")] # board배열에서 뽑은 인형들을 넣는 바구니 + + N = len(board) # board 2차원 배열은 N*N이므로, board의 행 또는 열의 길이를 N으로 받음. + + # moves 1차원 배열에 있는 요소에 따라 어떤 열의 인형을 뽑을 지 정함. + for move in moves: #[1 5 3 5 1 2 1 4] + move -= 1 # 1번째가 실제로 board배열에서는 0번째 이므로, 각 요소마다 1씩 빼줌. + doll = 0 # 인형이 비어있다고 가정 -> 0으로 초기화 + + for i in range(N): + if board[i][move] != 0: # 열은 move로 정해져 있고, 행이 i로 계속 변함. + doll = board[i][move] # 0이 아니라면, 인형이 있는 것이므로, 인형의 값을 변경 + board[i][move] = 0 + break + + if doll != 0: # 인형이 비어있지 않아서 doll에 새로운 인형의 값이 들어갔을 때, + if basket[-1] == doll: # 바구니 가장 위에 담긴 인형과 새로 뽑은 인형이 같다면 + basket.pop() # 바구니 가장 위의 인형 제거 + answer += 2 # 같은 인형이 바구니에 담겼으므로, 2개의 인형이 터짐 + else: + basket.append(doll) # 바구니의 가장 위의 인형과 같은 인형이 아니라면, doll을 새로 바구니에 추가하기 + return answer \ No newline at end of file From e76405160a11d42b1c5889d703e54ee588557eb1 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Sat, 13 Apr 2024 02:24:59 +0900 Subject: [PATCH 35/48] =?UTF-8?q?2024-04-13=20=EB=93=A3=EB=B3=B4=EC=9E=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 1 + .../1764.cpp" | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 "oesnuj/\354\235\264\353\266\204\355\203\220\354\203\211/1764.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index e5d0c1f..a1d5c67 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -6,4 +6,5 @@ | 2차시 | 2024.03.29 | 연결리스트 | [에디터](https://www.acmicpc.net/problem/1406) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/8) | | 3차시 | 2024.04.02 | 덱 | [카드 놓기](https://www.acmicpc.net/problem/18115) | [#11](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/11) | | 4차시 | 2024.04.06 | 스택 | [옥상 정원 꾸미기](https://www.acmicpc.net/problem/6198) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/14) | +| 5차시 | 2024.04.13 | 이분탐색 | [듣보잡](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) | --- diff --git "a/oesnuj/\354\235\264\353\266\204\355\203\220\354\203\211/1764.cpp" "b/oesnuj/\354\235\264\353\266\204\355\203\220\354\203\211/1764.cpp" new file mode 100644 index 0000000..370a4f5 --- /dev/null +++ "b/oesnuj/\354\235\264\353\266\204\355\203\220\354\203\211/1764.cpp" @@ -0,0 +1,53 @@ +#include +#include +#include +#include +using namespace std; + + +bool binarySearch(vector &v, string str) //이분탐색 +{ + int left = 0; + int right = v.size() - 1; + while (left <= right) + { + int middle = (left + right) / 2; + if (str > v[middle]) + left = middle + 1; + else if (str < v[middle]) + right = middle - 1; + else + return true; + + } + return false; +} + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(NULL); + int n, m; + cin >> n >> m; + vector v(n); //듣도 못한 사람 입력 + for (auto& i : v){ + cin >> i; + } + sort(v.begin(), v.end()); //이분 탐색을 위해 정렬 + vector result; + for (int i = 0; i < m; i++) + { + string word; + cin >> word; //보도 못한 사람 입력 + if (binarySearch(v, word)){ //보도 못한 사람이 듣도 보다 못한 사람에도 포함되면 + result.push_back(word); + } + } + sort(result.begin(), result.end()); //마지막 사전순 정렬을 위해 정렬 + + cout << result.size() << "\n"; + for (const auto& word : result) { + cout << word << "\n"; + } + return 0; +} \ No newline at end of file From 18ce7d384d2a04d56405dfa757ca15388ee79659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Mon, 15 Apr 2024 20:14:31 +0900 Subject: [PATCH 36/48] =?UTF-8?q?2024-04-14=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?= =?UTF-8?q?=20=EC=A0=9C=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suhyun113/README.md | 3 ++- .../\354\212\244\355\203\235/6-suhyun113.py" | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 "suhyun113/\354\212\244\355\203\235/6-suhyun113.py" diff --git a/suhyun113/README.md b/suhyun113/README.md index d79604f..c74169e 100644 --- a/suhyun113/README.md +++ b/suhyun113/README.md @@ -6,4 +6,5 @@ | 2차시 | 2024.03.29 | 수학 | [소수 & 팰린드롬](https://www.acmicpc.net/problem/1747) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) | | 3차시 | 2024.04.02 | 그리디 | [거스름돈](https://www.acmicpc.net/problem/14916) | [#12](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/12) | | 4차시 | 2024.04.06 | DP | [피보나치 수 5](https://www.acmicpc.net/problem/10870) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/16) | -| 5차시 | 2024.04.10 | 스택 | [크레인 인형 뽑기 게임](https://school.programmers.co.kr/learn/courses/30/lessons/64061) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/19) | \ No newline at end of file +| 5차시 | 2024.04.10 | 스택 | [크레인 인형 뽑기 게임](https://school.programmers.co.kr/learn/courses/30/lessons/64061) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/19) | +| 6차시 | 2024.04.14 | 스택 | [컨트롤 제트](https://school.programmers.co.kr/learn/courses/30/lessons/120853) | [#21](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/21) | \ No newline at end of file diff --git "a/suhyun113/\354\212\244\355\203\235/6-suhyun113.py" "b/suhyun113/\354\212\244\355\203\235/6-suhyun113.py" new file mode 100644 index 0000000..6018767 --- /dev/null +++ "b/suhyun113/\354\212\244\355\203\235/6-suhyun113.py" @@ -0,0 +1,20 @@ +def solution(s): + answer = 0 + + stack = [float("inf")] + + # 문자열을 공백 기준으로 나누어 리스트에 저장 + s_list = s.split() + + for i in s_list: # i는 s_list의 인덱스가 아닌 값 + if i != 'Z': + stack.append(i) + else: + stack.pop() # stack의 가장 위의 값 빼기 + stack.pop(0) + + # 문자를 정수로 변환하기 + for i in stack: + n = int(i) + answer += n + return answer \ No newline at end of file From 41430fe15bec0e9cca32556a10a3db87cabe93ab Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Mon, 6 May 2024 06:29:23 +0900 Subject: [PATCH 37/48] =?UTF-8?q?2024-05-06=20=EC=A0=95=EC=82=AC=EA=B0=81?= =?UTF-8?q?=ED=98=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 1 + "oesnuj/\352\270\260\355\225\230/1485.cpp" | 53 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 "oesnuj/\352\270\260\355\225\230/1485.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index a1d5c67..5e5ddb8 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -7,4 +7,5 @@ | 3차시 | 2024.04.02 | 덱 | [카드 놓기](https://www.acmicpc.net/problem/18115) | [#11](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/11) | | 4차시 | 2024.04.06 | 스택 | [옥상 정원 꾸미기](https://www.acmicpc.net/problem/6198) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/14) | | 5차시 | 2024.04.13 | 이분탐색 | [듣보잡](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) | +| 6차시 | 2024.05.06 | 기하학 | [정사각형](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) | --- diff --git "a/oesnuj/\352\270\260\355\225\230/1485.cpp" "b/oesnuj/\352\270\260\355\225\230/1485.cpp" new file mode 100644 index 0000000..b795e78 --- /dev/null +++ "b/oesnuj/\352\270\260\355\225\230/1485.cpp" @@ -0,0 +1,53 @@ +#include +#include +#include +#include +using namespace std; + +struct Point +{ + int x, y; +}; + +int calcDistance(Point a, Point b) +{ + return pow(a.x - b.x, 2) + pow(a.y - b.y, 2); +} + +bool compareInfo(Point &a, Point &b) +{ + if(a.x == b.x) + return a.y < b.y; + return a.x < b.x; +} + +int main() { + ios::sync_with_stdio(false); + cin.tie(NULL); + + int n; + cin >> n; + + while (n--) + { + vector v(4); + for (int i = 0; i < 4; i++) { + cin >> v[i].x >> v[i].y; + } + sort(v.begin(), v.end(),compareInfo); + //2 3 + //0 1 + int s1 = calcDistance(v[0], v[1]); //선분 + int s2 = calcDistance(v[0], v[2]); + int s3 = calcDistance(v[1], v[3]); + int s4 = calcDistance(v[2], v[3]); + + int dia1 = calcDistance(v[0], v[3]); //대각선 + int dia2 = calcDistance(v[1], v[2]); + if (s1 == s2 && s2 == s3 && s3 == s4 && dia1 == dia2) //네변의 길이가 같고 대각선의 길이가 같다. + cout << 1 << '\n'; + else + cout << 0 << '\n'; + } + return 0; +} \ No newline at end of file From ba00b4e45df27b2f09f039e8653a6a5d5f598efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=ED=99=8D=EA=B5=AC?= Date: Tue, 7 May 2024 12:19:48 +0900 Subject: [PATCH 38/48] =?UTF-8?q?2024-05-07=20=EB=8B=A4=ED=95=AD=EC=8B=9D?= =?UTF-8?q?=20=EB=8D=94=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- honggukang0623/README.md | 5 +++ ...5 \353\215\224\355\225\230\352\270\260.js" | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 "honggukang0623/\353\213\244\355\225\255\354\213\235 \353\215\224\355\225\230\352\270\260/\353\213\244\355\225\255\354\213\235 \353\215\224\355\225\230\352\270\260.js" diff --git a/honggukang0623/README.md b/honggukang0623/README.md index a31df9a..4134418 100644 --- a/honggukang0623/README.md +++ b/honggukang0623/README.md @@ -4,3 +4,8 @@ |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.03.26 | 사칙연산 |[분수의덧셈]https://school.programmers.co.kr/learn/courses/30/lessons/120808 | [#5]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/5 | | 2차시 | 2024.03.29 | 배열 |[배열두배만들기]https://school.programmers.co.kr/learn/courses/30/lessons/120809 | [#7]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/7 | +<<<<<<< Updated upstream +======= +| 3차시 | 2024.04.05 | 배열 |[중앙값구하기]https://school.programmers.co.kr/learn/courses/30/lessons/120811# | [#13]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/13 | +| 4차시 | 2024.04.09 | 출력 |[직각삼각형출력하기]https://school.programmers.co.kr/learn/courses/30/lessons/120823 | [#17]https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/17/commits| +>>>>>>> Stashed changes diff --git "a/honggukang0623/\353\213\244\355\225\255\354\213\235 \353\215\224\355\225\230\352\270\260/\353\213\244\355\225\255\354\213\235 \353\215\224\355\225\230\352\270\260.js" "b/honggukang0623/\353\213\244\355\225\255\354\213\235 \353\215\224\355\225\230\352\270\260/\353\213\244\355\225\255\354\213\235 \353\215\224\355\225\230\352\270\260.js" new file mode 100644 index 0000000..6c5bf6a --- /dev/null +++ "b/honggukang0623/\353\213\244\355\225\255\354\213\235 \353\215\224\355\225\230\352\270\260/\353\213\244\355\225\255\354\213\235 \353\215\224\355\225\230\352\270\260.js" @@ -0,0 +1,36 @@ +function solution(polynomial) { + const values = polynomial.split(' + '); + console.log("values : ", values); + let x = 0; + let c = 0; + for(let i=0;i 1) { + answer += `${x}x`; + } + + if(x === 0 && c > 0) { + answer += c; + } + else if(c > 0) { + answer += ` + ${c}`; + } + return answer; +} From 5d67668853c523bb76202a7aa6e731724fae1fb2 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Wed, 8 May 2024 02:00:32 +0900 Subject: [PATCH 39/48] 2024-05-08 queuestack --- oesnuj/README.md | 1 + "oesnuj/\353\215\261/24511.cpp" | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 "oesnuj/\353\215\261/24511.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index 5e5ddb8..0c1da06 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -8,4 +8,5 @@ | 4차시 | 2024.04.06 | 스택 | [옥상 정원 꾸미기](https://www.acmicpc.net/problem/6198) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/14) | | 5차시 | 2024.04.13 | 이분탐색 | [듣보잡](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) | | 6차시 | 2024.05.06 | 기하학 | [정사각형](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) | +| 7차시 | 2024.05.08 | 스택, 큐, 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) | --- diff --git "a/oesnuj/\353\215\261/24511.cpp" "b/oesnuj/\353\215\261/24511.cpp" new file mode 100644 index 0000000..1868b93 --- /dev/null +++ "b/oesnuj/\353\215\261/24511.cpp" @@ -0,0 +1,35 @@ +#include +#include +#include +using namespace std; + +int main() +{ + ios::sync_with_stdio(false); cin.tie(NULL); + int n; + cin >> n; + vector dataStructure(n); //스텍인지 큐인지 입력받기 + for (auto& i : dataStructure){ + cin >> i; + } + + deque queuestack; + for (int i = 0; i < n; i++) + { + int x; + cin >> x; + if (dataStructure.at(i) == 0) //큐인 경우에만 처리, 스택은 무조건 입력값이 나오기에 없다고 보면됨 + queuestack.push_back(x); + } + int m; + cin >> m; + for (int i = 0; i < m; i++) + { + int x; + cin >> x; + queuestack.push_front(x); + cout << queuestack.back() << " "; + queuestack.pop_back(); + } + return 0; +} From 3fa8893f04bebca3d8bb7ec33f4ea8a662c3bd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <202230418@pukyong.ac.kr> Date: Fri, 10 May 2024 15:59:27 +0900 Subject: [PATCH 40/48] 2024-05-10 ATM --- pu2rile/README.md | 5 +++++ .../ATM.py" | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 "pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/ATM.py" diff --git a/pu2rile/README.md b/pu2rile/README.md index f04c429..d512921 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -6,3 +6,8 @@ | 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/6#issue-2214931034)| | 3차시 | 2024.04.02 | 문자열 | [크로아티아 알파벳](https://www.acmicpc.net/problem/8958) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/10#issue-2220631332) | 4차시 | 2024.04.08 | 스택 | [제로](https://www.acmicpc.net/problem/10773) | [#15](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/15#issue-2229909173) +<<<<<<< Updated upstream +======= +| 5차시 | 2024.04.10 | 그리디 알고리즘 | [국회의원 선거](https://www.acmicpc.net/problem/1417) | [#18](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/18#issue-2235862658) +| 6차시 | 2024.05.10 | 그리디 알고리즘 | [ATM](https://www.acmicpc.net/problem/11399) | [#]() +>>>>>>> Stashed changes diff --git "a/pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/ATM.py" "b/pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/ATM.py" new file mode 100644 index 0000000..042c305 --- /dev/null +++ "b/pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/ATM.py" @@ -0,0 +1,9 @@ +num = int(input()) +arr = list(map(int, input().split())) +arr.sort() #입력받은 정수 오름차순 정렬 +result = 0 +time = 0 +for i in range(num): + time += arr[i] #현재 사람이 기다리는 시간을 계산해서 time에 더함 + result += time #현재 사람까지의 총 대기 시간을 결과에 더함 +print(result) \ No newline at end of file From f844cb4be1cd4ce2fdec2e6d85e44ed3b34c1a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84=20KimDohyun?= <163822282+pu2rile@users.noreply.github.com> Date: Fri, 10 May 2024 16:02:26 +0900 Subject: [PATCH 41/48] Update README.md --- pu2rile/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pu2rile/README.md b/pu2rile/README.md index d512921..df4d5e5 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -9,5 +9,5 @@ <<<<<<< Updated upstream ======= | 5차시 | 2024.04.10 | 그리디 알고리즘 | [국회의원 선거](https://www.acmicpc.net/problem/1417) | [#18](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/18#issue-2235862658) -| 6차시 | 2024.05.10 | 그리디 알고리즘 | [ATM](https://www.acmicpc.net/problem/11399) | [#]() +| 6차시 | 2024.05.10 | 그리디 알고리즘 | [ATM](https://www.acmicpc.net/problem/11399) | [#25](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/25#issue-2289086909) >>>>>>> Stashed changes From c84a9f85977abd3a924cbbc99eef63b9f9ca1cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=9C=20Junseo=20Kim?= Date: Mon, 13 May 2024 02:47:16 +0900 Subject: [PATCH 42/48] Update README.md --- oesnuj/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oesnuj/README.md b/oesnuj/README.md index 0c1da06..d7f8d25 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -8,5 +8,5 @@ | 4차시 | 2024.04.06 | 스택 | [옥상 정원 꾸미기](https://www.acmicpc.net/problem/6198) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/14) | | 5차시 | 2024.04.13 | 이분탐색 | [듣보잡](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) | | 6차시 | 2024.05.06 | 기하학 | [정사각형](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) | -| 7차시 | 2024.05.08 | 스택, 큐, 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) | +| 7차시 | 2024.05.08 | 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) | --- From db333684c73bf9e95a7a457cfb8372655195d5a0 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Mon, 13 May 2024 12:26:55 +0900 Subject: [PATCH 43/48] =?UTF-8?q?2024-05-13=20=EC=B9=B4=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 1 + .../1715.cpp" | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 "oesnuj/\354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/1715.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index 0c1da06..c49dc46 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -9,4 +9,5 @@ | 5차시 | 2024.04.13 | 이분탐색 | [듣보잡](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) | | 6차시 | 2024.05.06 | 기하학 | [정사각형](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) | | 7차시 | 2024.05.08 | 스택, 큐, 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) | +| 8차시 | 2024.05.13 | 우선순위 큐 | [카드 정렬하기](https://www.acmicpc.net/problem/1715) | [#27](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/27) | --- diff --git "a/oesnuj/\354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/1715.cpp" "b/oesnuj/\354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/1715.cpp" new file mode 100644 index 0000000..7311750 --- /dev/null +++ "b/oesnuj/\354\232\260\354\204\240\354\210\234\354\234\204 \355\201\220/1715.cpp" @@ -0,0 +1,33 @@ +#include +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(false); cin.tie(NULL); + + priority_queue , greater> pq; //최소 힙으로 우선순위 큐 선언 + int n; + cin >> n; + for (int i = 0; i < n; i++) //우선순위 큐에 다 넣음 + { + int x; + cin >> x; + pq.push(x); + } + int result = 0; + while(pq.size() > 1) //우선순위 큐에 값이 하나만 남을 때 까지 반복 + { + // 우선순위 큐에서 가장 작은 두 수를 꺼내서 합침 + int a = pq.top(); + pq.pop(); + int b = pq.top(); + pq.pop(); + int sum = a + b; + pq.push(sum); // 합친 결과를 우선순위 큐에 다시 넣음 + + result += sum; // 결과값을 누적 + } + cout << result; + return 0; +} \ No newline at end of file From d8f1ecc04ab860de057bf33f6bb015e7d993cb28 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 30 May 2024 20:45:22 +0900 Subject: [PATCH 44/48] =?UTF-8?q?2024-05-30=20=EB=B9=99=EA=B3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 1 + "oesnuj/\352\265\254\355\230\204/2578.cpp" | 79 ++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 "oesnuj/\352\265\254\355\230\204/2578.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index c49dc46..f16f53f 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -10,4 +10,5 @@ | 6차시 | 2024.05.06 | 기하학 | [정사각형](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) | | 7차시 | 2024.05.08 | 스택, 큐, 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) | | 8차시 | 2024.05.13 | 우선순위 큐 | [카드 정렬하기](https://www.acmicpc.net/problem/1715) | [#27](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/27) | +| 9차시 | 2024.05.30 | 구현 | [빙고](https://www.acmicpc.net/problem/2578) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/30) | --- diff --git "a/oesnuj/\352\265\254\355\230\204/2578.cpp" "b/oesnuj/\352\265\254\355\230\204/2578.cpp" new file mode 100644 index 0000000..04b2adc --- /dev/null +++ "b/oesnuj/\352\265\254\355\230\204/2578.cpp" @@ -0,0 +1,79 @@ +#include +using namespace std; + +const int BINGO_SIZE = 5; +int board[BINGO_SIZE][BINGO_SIZE]; + +void changeBingo(int target); +int checkBingo(); + + + +int main() +{ + ios::sync_with_stdio(0); cin.tie(0); + for (int i = 0; i < BINGO_SIZE; i++) + { + for (int j = 0; j < BINGO_SIZE; j++) + { + cin >> board[i][j]; + } + } + + int sayCnt = 0; + for (int i = 0; i < BINGO_SIZE * BINGO_SIZE; i++) + { + int num; + cin >> num; + sayCnt++; + changeBingo(num); + if (checkBingo() >= 3) { + cout << sayCnt; + return 0; + } + } + return 0; +} + + +void changeBingo(int target) //사회자가 부른 수 체크하기 +{ + for (int i = 0; i < BINGO_SIZE; i++){ + for (int j = 0; j < BINGO_SIZE; j++){ + if (board[i][j] == target){ + board[i][j] = 0; + return; + } + } + } + return; +} + +int checkBingo() //현재 보드판에 빙고가 몇줄인지 +{ + int bingoCnt = 0; + + for (int i = 0; i < BINGO_SIZE; i++) //가로, 세로 빙고 확인 + { + int horizontal = 0, vertical = 0; + for (int j = 0; j < BINGO_SIZE; j++){ + if (!board[i][j]) + horizontal++; + if (!board[j][i]) + vertical++; + } + if (horizontal == BINGO_SIZE) bingoCnt++; + if (vertical == BINGO_SIZE) bingoCnt++; + } + + int right_diagonal = 0, left_diagonal = 0; + for (int i = 0; i < BINGO_SIZE; i++) //대각선 2개 빙고 확인 + { + if (!board[i][i]) right_diagonal++; + if (!board[i][BINGO_SIZE - i - 1]) left_diagonal++; + } + if (right_diagonal == BINGO_SIZE) bingoCnt++; + if (left_diagonal == BINGO_SIZE) bingoCnt++; + + return bingoCnt; +} \ No newline at end of file From c2985870e0d0005b210594a2245b0ee0590ef73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Mon, 1 Jul 2024 11:32:03 +0900 Subject: [PATCH 45/48] =?UTF-8?q?2024-05-09=20=EC=9B=90=EC=88=AD=EC=9D=B4?= =?UTF-8?q?=20=EB=A7=A4=EB=8B=AC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\355\212\270\353\246\254/7-suhyun113.py" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "suhyun113/\355\212\270\353\246\254/7-suhyun113.py" diff --git "a/suhyun113/\355\212\270\353\246\254/7-suhyun113.py" "b/suhyun113/\355\212\270\353\246\254/7-suhyun113.py" new file mode 100644 index 0000000..f12a44f --- /dev/null +++ "b/suhyun113/\355\212\270\353\246\254/7-suhyun113.py" @@ -0,0 +1,27 @@ +# 2716 : 원숭이 매달기 + +N = int(input()) # 테스트 케이스의 개수 +results = [] + +for _ in range(N): + s = input().strip() + len_s = len(s) + + depth = 0 + max_depth = 0 + + for i in range(len_s): + if (s[i] == '['): + depth += 1 + if (depth > max_depth): + max_depth = depth + elif (s[i] == ']'): + depth -= 1 + + result = 1 #나무 꼭대기 도달위해 최소 한 마리 원숭이 필요 + for _ in range(max_depth): + result *= 2 + results.append(result) + +for result in results: + print(result) \ No newline at end of file From 8974a6876593743239eeb1f076e0ea5c93714f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Mon, 1 Jul 2024 11:34:14 +0900 Subject: [PATCH 46/48] =?UTF-8?q?Revert=20"2024-05-09=20=EC=9B=90=EC=88=AD?= =?UTF-8?q?=EC=9D=B4=20=EB=A7=A4=EB=8B=AC=EA=B8=B0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c2985870e0d0005b210594a2245b0ee0590ef73d. --- .../\355\212\270\353\246\254/7-suhyun113.py" | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 "suhyun113/\355\212\270\353\246\254/7-suhyun113.py" diff --git "a/suhyun113/\355\212\270\353\246\254/7-suhyun113.py" "b/suhyun113/\355\212\270\353\246\254/7-suhyun113.py" deleted file mode 100644 index f12a44f..0000000 --- "a/suhyun113/\355\212\270\353\246\254/7-suhyun113.py" +++ /dev/null @@ -1,27 +0,0 @@ -# 2716 : 원숭이 매달기 - -N = int(input()) # 테스트 케이스의 개수 -results = [] - -for _ in range(N): - s = input().strip() - len_s = len(s) - - depth = 0 - max_depth = 0 - - for i in range(len_s): - if (s[i] == '['): - depth += 1 - if (depth > max_depth): - max_depth = depth - elif (s[i] == ']'): - depth -= 1 - - result = 1 #나무 꼭대기 도달위해 최소 한 마리 원숭이 필요 - for _ in range(max_depth): - result *= 2 - results.append(result) - -for result in results: - print(result) \ No newline at end of file From 82bdab7e6fe4873ad658f1c5e9456bae5f48c445 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 4 Jul 2024 06:56:25 +0900 Subject: [PATCH 47/48] =?UTF-8?q?2024-07-04=20=EC=83=81=EC=96=B4=EC=B4=88?= =?UTF-8?q?=EB=93=B1=ED=95=99=EA=B5=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/README.md | 1 + "oesnuj/\352\265\254\355\230\204/21608.js" | 78 ++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 "oesnuj/\352\265\254\355\230\204/21608.js" diff --git a/oesnuj/README.md b/oesnuj/README.md index f16f53f..2513849 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -11,4 +11,5 @@ | 7차시 | 2024.05.08 | 스택, 큐, 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) | | 8차시 | 2024.05.13 | 우선순위 큐 | [카드 정렬하기](https://www.acmicpc.net/problem/1715) | [#27](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/27) | | 9차시 | 2024.05.30 | 구현 | [빙고](https://www.acmicpc.net/problem/2578) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/30) | +| 10차시 | 2024.07.04 | 구현 | [상어초등학교](https://www.acmicpc.net/problem/21608) | [#34](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/34) | --- diff --git "a/oesnuj/\352\265\254\355\230\204/21608.js" "b/oesnuj/\352\265\254\355\230\204/21608.js" new file mode 100644 index 0000000..6c471d4 --- /dev/null +++ "b/oesnuj/\352\265\254\355\230\204/21608.js" @@ -0,0 +1,78 @@ +const fs = require('fs'); +const filepath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; +const input = fs.readFileSync(filepath).toString().trim().split('\n'); +//입력 데이터 정리 +const N = +input.shift(); +const students = input.map(x => { + const [num, ...likes] = x.trim().split(' ').map(Number); + return { num, likes }; +}); + +let board = Array.from({ length: N }, () => Array(N).fill(0)); + +const dr = [-1, 1, 0, 0]; +const dc = [0, 0, -1, 1]; + +main(); + +function main(){ + for(let i=0; i< N**2; i++){ + if(i == 0){ + board[1][1] = students[i].num; //첫학생은 1,1에 무조건 앉는다. + continue; + } + choiceSeat(students[i].num); //학생을 조건에 맞게 앉히기 + } + console.log(calcSatisfy()); //모두 앉은 후 만족도 계산하기 +} + +// 최적의 자리 선택 및 학생 배치 함수 +function choiceSeat(studentNum){ + const neighborInfos = []; //인접 자리 정보를 모으는 배열 + for(let i = 0; i { + if (a.match !== b.match) { + return b.match - a.match; // match 기준 내림차순 정렬 + } else if (a.empty !== b.empty) { + return b.empty - a.empty; // empty 기준 내림차순 정렬 + } else if (a.r !== b.r) { + return a.r - b.r; // r 기준 오름차순 정렬 + } else { + return a.c - b.c; // c 기준 오름차순 정렬 + } + }); + board[neighborInfos[0].r][neighborInfos[0].c] = studentNum; //최적의 위치에 앉히기 +} + +// 특정 자리의 인접 정보 계산 함수 +function getSeatInfo(r, c, studentNum){ + let empty = 0; + let match = 0; + // 학생 번호에 맞는 좋아하는 학생들 찾기 + let studentLikes = students.find(student => student.num === studentNum)?.likes || []; + for(let i = 0; i< 4; i++){ + nr = r + dr[i]; + nc= c + dc[i]; + if(nr < 0 || nc < 0 || nr >= N || nc >= N) continue; + if (board[nr][nc] == 0) empty++; + else if(studentLikes.includes(board[nr][nc])) match++ + } + return { r: r, c: c, empty: empty, match: match }; +} + +//만족도 처리 +function calcSatisfy(){ + let result = 0; + for(let i = 0; i Date: Wed, 10 Jul 2024 21:16:25 +0900 Subject: [PATCH 48/48] Update README.md --- pu2rile/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/pu2rile/README.md b/pu2rile/README.md index df4d5e5..2146df3 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -6,8 +6,5 @@ | 2차시 | 2024.03.29 | 구현 | [OX퀴즈](https://www.acmicpc.net/problem/8958) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/6#issue-2214931034)| | 3차시 | 2024.04.02 | 문자열 | [크로아티아 알파벳](https://www.acmicpc.net/problem/8958) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/10#issue-2220631332) | 4차시 | 2024.04.08 | 스택 | [제로](https://www.acmicpc.net/problem/10773) | [#15](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/15#issue-2229909173) -<<<<<<< Updated upstream -======= | 5차시 | 2024.04.10 | 그리디 알고리즘 | [국회의원 선거](https://www.acmicpc.net/problem/1417) | [#18](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/18#issue-2235862658) | 6차시 | 2024.05.10 | 그리디 알고리즘 | [ATM](https://www.acmicpc.net/problem/11399) | [#25](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/25#issue-2289086909) ->>>>>>> Stashed changes