선릉역 1번 출구

baekjoon - 14467 본문

Algorithm/Algorithm 문제풀이

baekjoon - 14467

choideu 2021. 10. 3. 01:57

백준 14467 - 소가 길을 건너간 이유

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

 

14467번: 소가 길을 건너간 이유 1

3번 소는 위치 1, 0, 1에서 관찰되었으므로 길을 최소 두 번 건넜음을 확인할 수 있다. 4번 소도 길을 한 번 건넜으며, 나머지 소는 길을 건넌 기록이 확인되지 않는다.

www.acmicpc.net

n = int(input())

start = [0] * 11
pos = [0] * 11
count = 0

for i in range(n):
    num, left_right = map(int, input().split())
    if start[num] == 1:
        if pos[num] != left_right:
            count += 1
            pos[num] = left_right
    else:
        start[num] = 1
        pos[num] = left_right

print(count)

'Algorithm > Algorithm 문제풀이' 카테고리의 다른 글

baekjoon - 2161  (0) 2021.10.03
baekjoon - 15886  (0) 2021.10.03
baekjoon - 15500  (0) 2021.10.03
baekjoon - 1912  (0) 2021.09.16
baekjoon - 14002  (0) 2021.09.16
Comments