본문으로 건너뛰기

BOJ 10807

10807 개수 세기

Clicking the heading will take you to the BOJ problem.

Solution

파이썬 쓰면 count() 같은 게 있으니 편하다. 근데 단점은 아래 방법이 바로 생각나지 않았다는 것. AI도 그렇고 파이썬도 그렇고 너무 쉬우면 예전 방법이 생각이 나지 않는다.

n = int(input())
num_list = list(map(int, input().split()))
v = int(input())

# print(num_list.count(v)) 이렇게 해도 풀린다.

count = 0

for num in num_list:
    if num == v:
        count += 1
       
print(count)