From 30a47d304ae3f19bf79e3108a98aa7efa7a30ec1 Mon Sep 17 00:00:00 2001 From: yjhss <20211420.sungshin.ac.kr> Date: Wed, 12 Apr 2023 19:23:47 +0900 Subject: [PATCH 1/2] =?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 --- ...206\214\354\210\230 \354\260\276\352\270\260.py" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "\354\235\264\355\213\260\354\234\240\354\247\204/1978_\354\206\214\354\210\230 \354\260\276\352\270\260.py" diff --git "a/\354\235\264\355\213\260\354\234\240\354\247\204/1978_\354\206\214\354\210\230 \354\260\276\352\270\260.py" "b/\354\235\264\355\213\260\354\234\240\354\247\204/1978_\354\206\214\354\210\230 \354\260\276\352\270\260.py" new file mode 100644 index 0000000..66d5447 --- /dev/null +++ "b/\354\235\264\355\213\260\354\234\240\354\247\204/1978_\354\206\214\354\210\230 \354\260\276\352\270\260.py" @@ -0,0 +1,13 @@ +n = int(input()) # 수의 개수 N 입력 받기 +numbers = map(int, input().split()) # N개의 수 입력 받기 +count = 0 # 소수의 개수를 세기 위한 변수 count 초기화 + +for num in numbers: + a = 0 + if num > 1 : + for i in range(2, num): # 2부터 (num-1)까지 (자기자신 제외) + if num % i == 0: + a += 1 # 2와 (num-1) 사이 숫자로 나누어 떨어지면 a 1씩 증가 + if a == 0: + count += 1 # a == 0 이면 소수이므로 count 1씩 증가 +print(count) \ No newline at end of file From 30ef9f5717ef5f2ceca089e56d834b4429dfb225 Mon Sep 17 00:00:00 2001 From: yjhss <20211420.sungshin.ac.kr> Date: Wed, 12 Apr 2023 19:29:19 +0900 Subject: [PATCH 2/2] =?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" | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 "\354\235\264\355\213\260\354\234\240\354\247\204/15650_N\352\263\274 M(2).py" diff --git "a/\354\235\264\355\213\260\354\234\240\354\247\204/15650_N\352\263\274 M(2).py" "b/\354\235\264\355\213\260\354\234\240\354\247\204/15650_N\352\263\274 M(2).py" new file mode 100644 index 0000000..5cba603 --- /dev/null +++ "b/\354\235\264\355\213\260\354\234\240\354\247\204/15650_N\352\263\274 M(2).py" @@ -0,0 +1,12 @@ +from itertools import combinations #itertools의 combinations 함수 + +n,m = map(int, input().split()) # N과 M 입력받기 + +a = [] # [1,2,3,4 ..] +for i in range(1,n+1): + a.append(i) + +for i in combinations(a,m): # a에서 원소 개수 m개인 조합을 뽑는 것, 출력 + for j in i: + print(j,end=' ') + print() \ No newline at end of file