有3个人
每个人有n个特征值(1 ≤ n ≤ 4 000)
求每个人都有的特征值有几个?(特征值 ≤ 10^9)
Sample
input | output |
---|---|
5 13 20 22 43 146 4 13 22 43 146 5 13 43 67 89 146 | 3 |
Problem Author: Denis Mukhametianov
Problem Source: Ural Regional School Programming Contest 2011
Problem Source: Ural Regional School Programming Contest 2011
class InputReader():
def nextInt(self):
return int(input().strip())
def nextLine(self):
return input()
def nextString(self):
return input().strip()
def nextInts(self):
ints = []
str = input().strip().split()
for s in str:
if (s is None) or (len(s) == 0):
continue
ints.append(int(s))
return ints
def nextFloats(self):
floats = []
str = input().strip().split()
for s in str:
if (s is None) or (len(s) == 0):
continue
floats.append(float(s))
return floats
if __name__ == '__main__':
reader = InputReader()
an = reader.nextInt() ;
a = reader.nextInts() ;
bn = reader.nextInt();
b = reader.nextInts();
cn = reader.nextInt();
c = reader.nextInts();
i = 0
j = 0
k = 0
sum = 0
while i < an and j < bn and k < cn :
if a[i] == b[j] and a[i] == c[k]:
sum += 1
id = 0
mi = a[i]
if mi > b[j]:
mi = b[j]
id = 1
if mi > c[k]:
mi = c[k]
id = 2
if id == 0 :
i += 1
elif id == 1:
j += 1
else:
k += 1
print(sum)