From 63e03b6f3394a2d2e8bd0ad126adf60577a5f189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=8D?= <79096808+0321minji@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:22:02 +0900 Subject: [PATCH 1/4] Create 10610.py --- 0321minji/[week09]/10610.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 0321minji/[week09]/10610.py diff --git a/0321minji/[week09]/10610.py b/0321minji/[week09]/10610.py new file mode 100644 index 0000000..2f7c6c6 --- /dev/null +++ b/0321minji/[week09]/10610.py @@ -0,0 +1,9 @@ +n=list(input()) +n.sort(reverse=True) + +n=int("".join(n)) +if n%30==0: + print(n) +else: + print(-1) + From fe2bfbea58e8c8bceba3c176291e991f95b88356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=8D?= <79096808+0321minji@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:22:22 +0900 Subject: [PATCH 2/4] Create 1213.py --- 0321minji/[week09]/1213.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 0321minji/[week09]/1213.py diff --git a/0321minji/[week09]/1213.py b/0321minji/[week09]/1213.py new file mode 100644 index 0000000..7394f80 --- /dev/null +++ b/0321minji/[week09]/1213.py @@ -0,0 +1,28 @@ +import sys + +input=sys.stdin.readline + +name=input().rstrip() +check={} +for i in list(name): + if i not in check: + check[i]=1 + else: + check[i]+=1 + +cnt=0 +mid='' +for a,c in list(check.items()): + if c%2==1: + cnt+=1 + mid=a + if cnt>1: + print("I'm Sorry Hansoo") + exit() +result='' +for a,c in sorted(check.items()): + result+=(a*(c//2)) #앞부분만 만드는 것-> 사용되는 알파벳 수/2 + +result=result+mid+result[::-1] + +print(result) From 39f0f048595c64192754ba7889c708683e3a26ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=8D?= <79096808+0321minji@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:22:41 +0900 Subject: [PATCH 3/4] Create 1647.py --- 0321minji/[week09]/1647.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 0321minji/[week09]/1647.py diff --git a/0321minji/[week09]/1647.py b/0321minji/[week09]/1647.py new file mode 100644 index 0000000..7394f80 --- /dev/null +++ b/0321minji/[week09]/1647.py @@ -0,0 +1,28 @@ +import sys + +input=sys.stdin.readline + +name=input().rstrip() +check={} +for i in list(name): + if i not in check: + check[i]=1 + else: + check[i]+=1 + +cnt=0 +mid='' +for a,c in list(check.items()): + if c%2==1: + cnt+=1 + mid=a + if cnt>1: + print("I'm Sorry Hansoo") + exit() +result='' +for a,c in sorted(check.items()): + result+=(a*(c//2)) #앞부분만 만드는 것-> 사용되는 알파벳 수/2 + +result=result+mid+result[::-1] + +print(result) From cf9f613a8f1b0ccf9aeb7989f9d14bd1661f6ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=8D?= <79096808+0321minji@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:47:54 +0900 Subject: [PATCH 4/4] Create 21924.py --- 0321minji/[week09]/21924.py | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 0321minji/[week09]/21924.py diff --git a/0321minji/[week09]/21924.py b/0321minji/[week09]/21924.py new file mode 100644 index 0000000..a6121d3 --- /dev/null +++ b/0321minji/[week09]/21924.py @@ -0,0 +1,47 @@ +#kruskal + +import sys +input=sys.stdin.readline + +def find(x): + if x!=parent[x]: + parent[x]=find(parent[x]) + return parent[x] + +def union(x,y): + a=find(x) + b=find(y) + + if a1: + return -1 + else: + return total + +n,m=map(int,input().split()) +parent=[ i for i in range(n+1)] +pq=[] +total=0 + +for _ in range(m): + a,b,c=map(int,input().split()) + pq.append((c,a,b)) + total+=c +pq.sort() +print(kruskal(n,total,pq))