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
#include <iostream>
const int n = 10;
const int m = 15;
int main()
{
int a[n] = {1,2,3,4,1,6,2,8,9,10};
int b[m] = {19,18,17,1,20,2,30,10,4,18,2,5,31,32,33};
bool f;
for (int i=0; i<n; i++)
f = true;
for (int j=0; j<i; j++)
if (a[i]==a[j])
f = false;
break;
}
if (f)
for (int j=0; j<m; j++)
if (a[i]==b[j])
std::cout <<a[i] <<' ';
std::cout <<std::endl;
return 0;
Объяснение:
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
#include <iostream>
const int n = 10;
const int m = 15;
int main()
{
int a[n] = {1,2,3,4,1,6,2,8,9,10};
int b[m] = {19,18,17,1,20,2,30,10,4,18,2,5,31,32,33};
bool f;
for (int i=0; i<n; i++)
{
f = true;
for (int j=0; j<i; j++)
if (a[i]==a[j])
{
f = false;
break;
}
if (f)
{
for (int j=0; j<m; j++)
if (a[i]==b[j])
{
std::cout <<a[i] <<' ';
break;
}
}
}
std::cout <<std::endl;
return 0;
}
Объяснение: