You are viewing a single comment's thread. Return to all comments →
In Python 3!
n,m = [int(i) for i in input().strip().split(' ')] a = [int(a_temp) for a_temp in input().strip().split(' ')] b = [int(b_temp) for b_temp in input().strip().split(' ')] result = 0 for x in range(max(a), min(b)+1): divideA = [x%j!=0 for j in a] divideB = [j%x!=0 for j in b] if sum(divideA)==0 and sum(divideB)==0: result += 1 print(result)
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
In Python 3!