From c25fd5df5e8bf95ea27665072f128eb6ca3498bb Mon Sep 17 00:00:00 2001 From: plum-king Date: Tue, 11 Apr 2023 23:56:42 +0900 Subject: [PATCH 1/4] =?UTF-8?q?#2=20:=201978=5F=EC=86=8C=EC=88=98=20?= =?UTF-8?q?=EC=B0=BE=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...6\214\354\210\230 \354\260\276\352\270\260.py" | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 "\354\235\264\353\213\210\354\247\200\354\210\230/1978_\354\206\214\354\210\230 \354\260\276\352\270\260.py" diff --git "a/\354\235\264\353\213\210\354\247\200\354\210\230/1978_\354\206\214\354\210\230 \354\260\276\352\270\260.py" "b/\354\235\264\353\213\210\354\247\200\354\210\230/1978_\354\206\214\354\210\230 \354\260\276\352\270\260.py" new file mode 100644 index 0000000..262b50b --- /dev/null +++ "b/\354\235\264\353\213\210\354\247\200\354\210\230/1978_\354\206\214\354\210\230 \354\260\276\352\270\260.py" @@ -0,0 +1,15 @@ +n = int(input()) +num = map(int, input().split()) + +sum = 0 +for i in num: + zeroNum = 0 + if i == 1: + zeroNum +=1 + else: + for j in range(2, int(i)): + if i % j == 0: + zeroNum+=1 + if zeroNum == 0: + sum+=1 +print(sum) \ No newline at end of file From a7383d51ee9d0f05d84363d2c386143bf65bd7b9 Mon Sep 17 00:00:00 2001 From: plum-king Date: Thu, 13 Apr 2023 12:41:04 +0900 Subject: [PATCH 2/4] =?UTF-8?q?#2=20:=2015650=5FN=EA=B3=BC=20M(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../15650_N\352\263\274 M(2).py" | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 "\354\235\264\353\213\210\354\247\200\354\210\230/15650_N\352\263\274 M(2).py" diff --git "a/\354\235\264\353\213\210\354\247\200\354\210\230/15650_N\352\263\274 M(2).py" "b/\354\235\264\353\213\210\354\247\200\354\210\230/15650_N\352\263\274 M(2).py" new file mode 100644 index 0000000..c2643b0 --- /dev/null +++ "b/\354\235\264\353\213\210\354\247\200\354\210\230/15650_N\352\263\274 M(2).py" @@ -0,0 +1,9 @@ +import itertools + +n, m = map(int, input().split()) +numlist = list(range(1, n+1)) +num = list(itertools.combinations(numlist ,m)) +for i in num: + for j in i: + print(j, end= ' ') + print() \ No newline at end of file From a1acf3756a12f6291b1a2355a5c7d36d7bb9ebba Mon Sep 17 00:00:00 2001 From: Jisoo Hwang <77599304+plum-king@users.noreply.github.com> Date: Thu, 11 May 2023 05:15:04 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Create=205567=EB=BC=88=EB=8C=80.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../5567\353\274\210\353\214\200.py" | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 "\354\235\264\353\213\210\354\247\200\354\210\230/5567\353\274\210\353\214\200.py" diff --git "a/\354\235\264\353\213\210\354\247\200\354\210\230/5567\353\274\210\353\214\200.py" "b/\354\235\264\353\213\210\354\247\200\354\210\230/5567\353\274\210\353\214\200.py" new file mode 100644 index 0000000..8fc1a8e --- /dev/null +++ "b/\354\235\264\353\213\210\354\247\200\354\210\230/5567\353\274\210\353\214\200.py" @@ -0,0 +1,38 @@ +# 5567 결혼식 + +# 입력 값 + +# 6 +# 5 +# 1 2 +# 1 3 +# 3 4 +# 2 3 +# 4 5 + +import sys +from collections import deque + +# N 과 M 입력 받는 방법 다름 +N = +M = + +graph = [[False] * (N + 1) for _ in range(N + 1)] + +for _ in range(M): + a, b = map(int, sys.stdin.readline().split()) + #그래프 초기 세팅 다름 + +visited = [0] * (N + 1) # false 대신 0 + +def bfs(V): + q = deque([V]) + visited[V] = 1 # 숫자 덧셈에 필요 + while q: + V = q.popleft() + for i in range(1, N + 1): #for문 범위 수정 + if not visited[i] and graph[V][i]: # visited[i] 관련 조건 다름 + q.append(i) + visited[i] = # visited[i] 구하는 방법 다름 +bfs(1) +# 추가 코드 From 145400580d257c07baba3aa963e927633ac18ae5 Mon Sep 17 00:00:00 2001 From: Jisoo Hwang <77599304+plum-king@users.noreply.github.com> Date: Thu, 11 May 2023 14:11:54 +0900 Subject: [PATCH 4/4] =?UTF-8?q?#21=20:=205567=5F=EA=B2=B0=ED=98=BC?= =?UTF-8?q?=EC=8B=9D.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7_\352\262\260\355\230\274\354\213\235.py" | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 "\354\235\264\353\213\210\354\247\200\354\210\230/5567_\352\262\260\355\230\274\354\213\235.py" diff --git "a/\354\235\264\353\213\210\354\247\200\354\210\230/5567_\352\262\260\355\230\274\354\213\235.py" "b/\354\235\264\353\213\210\354\247\200\354\210\230/5567_\352\262\260\355\230\274\354\213\235.py" new file mode 100644 index 0000000..c2bd080 --- /dev/null +++ "b/\354\235\264\353\213\210\354\247\200\354\210\230/5567_\352\262\260\355\230\274\354\213\235.py" @@ -0,0 +1,43 @@ +# 5567 결혼식 + +# 입력 값 + +# 6 +# 5 +# 1 2 +# 1 3 +# 3 4 +# 2 3 +# 4 5 + +import sys +from collections import deque + +N = int(sys.stdin.readline()) +M = int(sys.stdin.readline()) + +graph = [[False] * (N + 1) for _ in range(N + 1)] + +for _ in range(M): + a, b = map(int, sys.stdin.readline().split()) + graph[a].append(b) # a 인덱스에 b 넣기 + graph[b].append(a) # b 인덱스에 a 넣기 + +visited = [0] * (N + 1) # false 대신 0 넣기 -> 더해야돼서! + +def bfs(V): + q = deque([V]) + visited[V] = 1 + while q: + V = q.popleft() + for i in graph[V]: + if visited[i] == 0: + q.append(i) + visited[i] = visited[V] + 1 +bfs(1) +result = 0 +for i in range(2,N+1): + # 본인이거나 친구거나, 친구의 친구거나 경우의 수가 최대 3개 + if 0 < visited[i] <=3: + result += 1 +print(result)