-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProgram.cs
33 lines (24 loc) · 992 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Linq;
namespace Between_Two_Sets {
class Program {
public static int GetTotalX(int[] ar, int[] br, int lenght) {
int total = 0;
for (int i = 1; i <= 100; i++) {
if (ar.Any(x => i % x != 0))continue;
if (br.Any(x => x % i != 0))continue;
total++;
}
return total;
}
static void Main(string[] args) {
string[] firstMultipleInput = Console.ReadLine().TrimEnd().Split(' ');
int n = Convert.ToInt32(firstMultipleInput[0]);
int m = Convert.ToInt32(firstMultipleInput[1]);
int[] ar = Array.ConvertAll(Console.ReadLine().Split(' '), arTemp => Convert.ToInt32(arTemp));
int[] br = Array.ConvertAll(Console.ReadLine().Split(' '), brTemp => Convert.ToInt32(brTemp));
int total = GetTotalX(ar, br, Math.Max(n, m));
Console.WriteLine(total);
}
}
}