백준 code.plus 1978

강지훈·2022년 5월 6일

https://www.acmicpc.net/problem/1978

N=int(input())

a=list(map(int,input().split()))
cnt=0

for x in a:
flag=True
if x==1:
continue
elif x==2:
cnt+=1
else:
for i in range (2,x):
if x%i==0:
flag=False

    if flag:
        cnt+=1

print(cnt)

flag=True 일단 전제로 입력받은 자연수가
소수라고 가정

flag=True를
for x in a:
반복문 마다 초기화를 해야지 정답이 제대로 나온다

profile
never stop

0개의 댓글