Introfor

[백준] 1978번 소수 찾기 본문

Programming_prob/BaekJoon

[백준] 1978번 소수 찾기

YongArtist 2020. 10. 10. 20:43

소수는 약수로 1과 자기 자신만 가지는 수를 의미.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def solution():
    int(input())
    nums = list(map(int, input().split()))
    res = 0
 
    for i in nums:
        cnt = 0
        for j in range(1, i+1):
            if not i % j:
               cnt += 1
        if cnt == 2:
            res += 1
 
    return res
 
 
res = solution()
print(res)
cs

'Programming_prob > BaekJoon' 카테고리의 다른 글

[백준] 2525번 오븐 시계  (0) 2020.10.19
[백준] 2480번 주사위 세개  (0) 2020.10.18
[백준] 2839번 설탕 배달  (0) 2020.10.09
[백준] 1712번 손익분기점  (0) 2020.10.08
[백준] 1316번 그룹 단어 체커  (0) 2020.10.07
Comments