T-coding
백준 14467 소가 길을 건너간 이유 1 본문
728x90
728x90
https://www.acmicpc.net/problem/14467
14467번: 소가 길을 건너간 이유 1
3번 소는 위치 1, 0, 1에서 관찰되었으므로 길을 최소 두 번 건넜음을 확인할 수 있다. 4번 소도 길을 한 번 건넜으며, 나머지 소는 길을 건넌 기록이 확인되지 않는다.
www.acmicpc.net
코드
더보기
n = int(input())
arr = {}
ans = 0
for i in range(n):
a, b = map(int, input().split())
if a not in arr:
arr[a] = b
else:
if arr[a] != b:
arr[a] = b
ans += 1
print(ans)
728x90
300x250
'Baekjoon' 카테고리의 다른 글
백준 4198 열차정렬 / Python (0) | 2023.03.20 |
---|---|
백준 3186 소변기 / Python (0) | 2023.03.20 |
백준 3024 마라톤 틱택토 / Python (0) | 2023.03.19 |
백준 2784 가로 세로 퍼즐 / Python (0) | 2023.03.18 |
백준 1913 달팽이 / Python (0) | 2023.03.18 |