解题思路:
注意事项:
参考代码:
n=int(input()) dic1={} dic2={} for i in range(n): s=input().split() dic1[s[0]]=s[2] dic2[s[1]]=s[2] m=int(input()) def print_(c,d): if c!=d: print("Y") else: print("N") for i in range(m): a,b=input().split() if a.isdigit() and b.isdigit(): print_(dic2[a],dic2[b]) if not a.isdigit() and not b.isdigit(): print_(dic1[a],dic1[b]) if a.isdigit() and not b.isdigit(): print_(dic2[a],dic1[b]) if not a.isdigit() and b.isdigit(): print_(dic1[a],dic2[b])
0.0分
2 人评分