From 681f73c0ba6a2291c7676196609badd6eddcf23b Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:22:16 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[BOJ]=205014/=20=EC=8B=A4=EB=B2=84=201=20/?= =?UTF-8?q?=20=3F=3F=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jinny/5014.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 jinny/5014.py diff --git a/jinny/5014.py b/jinny/5014.py new file mode 100644 index 0000000..e0ab95c --- /dev/null +++ b/jinny/5014.py @@ -0,0 +1,38 @@ +from collections import deque + + +F, S ,G ,U ,D = map(int, input().split()) +visit = [False] * (F + 1) +count = [0] * (F + 1) + +def bfs(node): + global visit,count + q = deque() + q.append(node) + visit[node] = True + + while q: + x = q.popleft() + + if x == G: + visit[x] = True + return count[G] + + for i in (x+U, x-D): + + if 0 < i <= F and not visit[i]: + #print("set") + #print(i) + visit[i] = True + count[i] = count[x] + 1 + q.append(i) + + if count[G] == 0: + return "use the stairs" + +print(bfs(S)) + + + + + From c4f2aaa9b509739d2701c40f481a5928fd7828d6 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:24:31 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[PGS]=20=EC=8B=A0=EA=B3=A0=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=EB=B0=9B=EA=B8=B0.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60\352\263\274\353\260\233\352\270\260.py" | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 "jinny/\354\213\240\352\263\240\352\262\260\352\263\274\353\260\233\352\270\260.py" diff --git "a/jinny/\354\213\240\352\263\240\352\262\260\352\263\274\353\260\233\352\270\260.py" "b/jinny/\354\213\240\352\263\240\352\262\260\352\263\274\353\260\233\352\270\260.py" new file mode 100644 index 0000000..3f69cac --- /dev/null +++ "b/jinny/\354\213\240\352\263\240\352\262\260\352\263\274\353\260\233\352\270\260.py" @@ -0,0 +1,55 @@ +def solution(id_list, report, k): + report = set(report) + dict = {} + for i in report: + nm=i.split() + if nm[0] in dict: + dict[nm[0]] +=[nm[1]] + else: + dict[nm[0]] = [nm[1]] + + #print(dict) + + value_dic = [] + for i in dict.values(): + value_dic +=i + + #print(value_dic) + + stop_value = [] + for i in id_list: + if i in value_dic: + if value_dic.count(i) >= 2: + stop_value += [i] + + #print(stop_value) + + answer = [] + for i in id_list: + if i in dict.keys(): + #print("몰라"+i) + count = 0 + for j in dict[i]: + if j in stop_value: + count+=1 + answer.append(count) + else : + answer.append(0) + return answer + +def main(): + # 입력 예시 + id_list_1 = ["muzi", "frodo", "apeach", "neo"] + report_1 = ["muzi frodo", "apeach frodo", "frodo neo", "muzi neo", "apeach muzi"] + k_1 = 2 + + id_list_2 = ["con", "ryan"] + report_2 = ["ryan con", "ryan con", "ryan con", "ryan con"] + k_2 = 3 + + # 결과 출력 + print(solution(id_list_1, report_1, k_1)) # [2, 1, 1, 0] + print(solution(id_list_2, report_2, k_2)) # [0, 0] + +if __name__ == "__main__": + main() From 1e3c663a906103b3edbc4683cabeeeb49f4b6e27 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:34:24 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[BOJ]20920.py=20/=20=EC=8B=A4=EB=B2=843=20/?= =?UTF-8?q?=20=3F=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jinny/20920.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 jinny/20920.py diff --git a/jinny/20920.py b/jinny/20920.py new file mode 100644 index 0000000..bc29dd3 --- /dev/null +++ b/jinny/20920.py @@ -0,0 +1,39 @@ +# 7 4 +# apple +# ant +# sand +# apple +# append +# sand +# sand + + +# 1.자주 +# 2.길수록 +# 3.알파벳 +# 4. m길이 이상 + +import sys + + +n,m = map(int, input().split()) +word = {} +for i in range(n): + word_str = sys.stdin.readline().strip() + + if len(word_str) >= m : + if word_str in word: + word[word_str] +=1 + else : + word[word_str] =1 + else : + continue; + +#print(word) +sorted_word = sorted(word.items(), key=lambda item: (-item[1], -len(item[0]), item[0])) +#print(sorted_word) + +for key in sorted_word: + print(key[0]) + + From 3c4bf7f7110e1a7f840200f6cd930f41366a569b Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:36:22 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[PGS]=EC=8B=A0=EA=B3=A0=EA=B2=B0=EA=B3=BC?= =?UTF-8?q?=EB=B0=9B=EA=B8=B0.py/Lv.=201/=EC=8B=A4=ED=8C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...263\240\352\262\260\352\263\274\353\260\233\352\270\260.py" | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git "a/jinny/\354\213\240\352\263\240\352\262\260\352\263\274\353\260\233\352\270\260.py" "b/jinny/\354\213\240\352\263\240\352\262\260\352\263\274\353\260\233\352\270\260.py" index 3f69cac..1ed3037 100644 --- "a/jinny/\354\213\240\352\263\240\352\262\260\352\263\274\353\260\233\352\270\260.py" +++ "b/jinny/\354\213\240\352\263\240\352\262\260\352\263\274\353\260\233\352\270\260.py" @@ -35,8 +35,7 @@ def solution(id_list, report, k): answer.append(count) else : answer.append(0) - return answer - + return answer def main(): # 입력 예시 id_list_1 = ["muzi", "frodo", "apeach", "neo"]