From fedd1ccb20970d0dd56fcfacb55f026893d2c28c Mon Sep 17 00:00:00 2001 From: H0ngJu Date: Tue, 5 Mar 2024 14:01:00 +0900 Subject: [PATCH 1/4] 2024-03-05 --- H0ngJu/README.md | 9 +++++---- "H0ngJu/\355\201\220/process.py" | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 "H0ngJu/\355\201\220/process.py" diff --git a/H0ngJu/README.md b/H0ngJu/README.md index d01c5315..3a8c7669 100644 --- a/H0ngJu/README.md +++ b/H0ngJu/README.md @@ -1,6 +1,7 @@ -## ✏️ 기록 +## ✏️ 기록 + +| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | +| :---: | :--------: | :------: | :-------------------------------------------------------------------------: | :--: | +| 1차시 | 2024.03.05 | 큐 | [프로세스](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | | -| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | -|:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.03.04 | BFS | 리코쳇 로봇 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/1 | --- diff --git "a/H0ngJu/\355\201\220/process.py" "b/H0ngJu/\355\201\220/process.py" new file mode 100644 index 00000000..fd8edd05 --- /dev/null +++ "b/H0ngJu/\355\201\220/process.py" @@ -0,0 +1,18 @@ +from collections import deque + +def solution(priorities, location): + answer = 0 + queue = deque([(i, k) for i, k in enumerate(priorities)]) # 튜플 큐 생성 + priorities.sort(reverse=True) # 내림차순 정렬 + + while queue: + cur = queue.popleft() # 가장 앞의 프로세스 꺼내기 (queue.pop(0)) + if cur[0] == priorities[0]: # 내림차순으로 정렬된 우선순위 == 현재 순위 -> 가장 높음 + answer += 1 # 수 ++ + if cur[1] == location: # 찾고자하는 process인 경우 + break + priorities.pop(0) + else: + queue.append(cur) # 뒤로 미루기 + + return answer \ No newline at end of file From 3c92be6467751a6cd900be87c54b47b940855e44 Mon Sep 17 00:00:00 2001 From: H0ngJu Date: Tue, 5 Mar 2024 14:09:04 +0900 Subject: [PATCH 2/4] test --- "H0ngJu/\355\201\220/process.py" | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git "a/H0ngJu/\355\201\220/process.py" "b/H0ngJu/\355\201\220/process.py" index fd8edd05..86bde575 100644 --- "a/H0ngJu/\355\201\220/process.py" +++ "b/H0ngJu/\355\201\220/process.py" @@ -15,4 +15,6 @@ def solution(priorities, location): else: queue.append(cur) # 뒤로 미루기 - return answer \ No newline at end of file + return answer + +#test \ No newline at end of file From c1f3ff726f88fa409153705470ced9114c757a2e Mon Sep 17 00:00:00 2001 From: H0ngJu Date: Tue, 5 Mar 2024 14:51:08 +0900 Subject: [PATCH 3/4] 2024-03-05 --- "H0ngJu/\355\201\220/process.py" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/H0ngJu/\355\201\220/process.py" "b/H0ngJu/\355\201\220/process.py" index 86bde575..b966f0a5 100644 --- "a/H0ngJu/\355\201\220/process.py" +++ "b/H0ngJu/\355\201\220/process.py" @@ -2,7 +2,7 @@ def solution(priorities, location): answer = 0 - queue = deque([(i, k) for i, k in enumerate(priorities)]) # 튜플 큐 생성 + queue = deque([(i, k) for k, i in enumerate(priorities)]) # 튜플 큐 생성 priorities.sort(reverse=True) # 내림차순 정렬 while queue: From e06b723427e65c043325943adecfe50f7c30c08d Mon Sep 17 00:00:00 2001 From: H0ngJu Date: Thu, 7 Mar 2024 23:59:59 +0900 Subject: [PATCH 4/4] =?UTF-8?q?readme=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- H0ngJu/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/H0ngJu/README.md b/H0ngJu/README.md index 3a8c7669..af4ff40e 100644 --- a/H0ngJu/README.md +++ b/H0ngJu/README.md @@ -1,7 +1,7 @@ ## ✏️ 기록 -| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | -| :---: | :--------: | :------: | :-------------------------------------------------------------------------: | :--: | -| 1차시 | 2024.03.05 | 큐 | [프로세스](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | | +| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | +| :---: | :--------: | :------: | :-------------------------------------------------------------------------: | :-------------------------------------------------: | +| 1차시 | 2024.03.05 | 큐 | [프로세스](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/151 | ---