class Solution:
def fourSumCount(self, nums1: List[int], nums2: List[int], nums3: List[int], nums4: List[int]) -> int:
#用dic来做hash表,a+b作为key,a+b出现次数作为value
hash_map=dict()
for a in nums1:
for b in nums2:
if (a+b) in hash_map:
hash_map[a+b]+=1
else:
hash_map[a+b]=1
#遍历C和D,若0-(c+d)出现在hash_map中,把对应的value取出,覆盖计数变量count
count=0
for c in nums3:
for d in nums4:
tmp=0-(c+d)
if tmp in hash_map:
count+=hash_map[tmp]
return count