From 8e5e98032646f6799e639ba3e1540d85eb82fe4f Mon Sep 17 00:00:00 2001 From: Dhanush Krishna R Date: Sun, 9 Oct 2022 16:12:37 +0530 Subject: [PATCH 1/2] Created a program which returns the count of elements which are factors of the first array and are divisible by the numbers in the second array --- Python Programs/divisible.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Python Programs/divisible.py diff --git a/Python Programs/divisible.py b/Python Programs/divisible.py new file mode 100644 index 0000000..e69de29 From 4d5e49b3a9ddd500a12e6408b69599a27020a3ff Mon Sep 17 00:00:00 2001 From: Dhanush Krishna R Date: Sun, 9 Oct 2022 16:21:46 +0530 Subject: [PATCH 2/2] Created a program which returns the count of elements which are factors of the first array and are divisible by the numbers in the second array --- Python Programs/divisible.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Python Programs/divisible.py b/Python Programs/divisible.py index e69de29..b8d9dbc 100644 --- a/Python Programs/divisible.py +++ b/Python Programs/divisible.py @@ -0,0 +1,29 @@ +import math +import os +import random +import re +import sys +def getTotalX(a, b): + count = 0 + A = max(a) + B = min(b) + for num in range(A, B + 1): + l=[] + check=True + for A in a: + if num%A !=0: + check=False + for B in b: + if B%num !=0: + check=False + if check: + count+=1 + return count +if __name__ == '__main__': + first_multiple_input = input().rstrip().split() + n = int(first_multiple_input[0]) + m = int(first_multiple_input[1]) + arr = list(map(int, input().rstrip().split())) + brr = list(map(int, input().rstrip().split())) + total = getTotalX(arr, brr) + print(str(total) + '\n') \ No newline at end of file