Skip to content

Commit

Permalink
Merge pull request #7 from INIT-Algorithm/yoojin
Browse files Browse the repository at this point in the history
#2 : Week1_유진이티
  • Loading branch information
leejw-lu authored Apr 14, 2023
2 parents 44ee386 + 30ef9f5 commit 6dbbf47
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 이티유진/15650_N과 M(2).py
Original file line number Diff line number Diff line change
@@ -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()
13 changes: 13 additions & 0 deletions 이티유진/1978_소수 찾기.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 6dbbf47

Please sign in to comment.