-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathset.c
More file actions
38 lines (38 loc) · 682 Bytes
/
set.c
File metadata and controls
38 lines (38 loc) · 682 Bytes
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
34
35
36
37
38
#include<stdio.h>
int main()
{
int n,m,counta=0,countb=0,count=0,i,j,x;
scanf("%d %d",&n,&m);
int a[n],b[m];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(j=0;j<m;j++)
{
scanf("%d",&b[j]);
}
for(x=0;x<100;x++)
{
for(i=0;i<n;i++)
{
if(x%a[i]==0)
{
counta++;
}
}
for(j=0;j<m;j++)
{
if(b[j]%x==0)
{
countb++;
}
}
if((counta==n)&&(countb==m))
{
count++;
}
}
printf("%d",count);
return 0;
}