Skip to content

Commit 358eb9b

Browse files
committed
[BOJ] 14467 소가 길을 건너간 이유 1 (B1)
1 parent a0f4de7 commit 358eb9b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

심수연/6주차/260205.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# https://www.acmicpc.net/problem/14467
2+
3+
import sys
4+
from collections import defaultdict
5+
input = sys.stdin.readline
6+
7+
N = int(input())
8+
9+
count = 0
10+
11+
dict = {}
12+
13+
for i in range(N):
14+
cow, location = map(int, input().split())
15+
16+
if cow not in dict: # cow가 없을 땐
17+
dict[cow] = location # 초기화
18+
elif location != dict[cow]: # cow가 이미 있는데 location 이 다를 땐
19+
count += 1 # count up
20+
dict[cow] = location # 업데이트
21+
22+
print(count)

0 commit comments

Comments
 (0)