본문 바로가기
python-algorithm

[백준] 20362

by 무적김두칠 2021. 2. 8.

1
2
3
4
5
6
7
8
9
10
11
12
n,s=input().split()
n=int(n); s=str(s)
tmp=[]
for _ in range(n):
    a,b=input().split()
    if a==s: ans=b
    tmp.append((a,b))
cnt=0
for i in range(len(tmp)):
    if tmp[i][1]==ans:
        if tmp[i][0]!=s: cnt+=1
    if tmp[i][0== s: print(cnt);break
cs
반응형

'python-algorithm' 카테고리의 다른 글

[백준] 1145  (0) 2021.02.08
[백준] 1037  (0) 2021.02.08
[백준] 20205  (0) 2021.02.08
[백준] 20154  (0) 2021.02.08
[백준] 20113  (0) 2021.02.08

댓글