#include
#include
using namespace std;
int main() {
int n,m,k=0;
cin >> n >> m;
int x[n], y[m];
srand(time(0));
for (int i = 0; i < n; i++) {
x[i]=rand() % 20;
cout << x[i] << " ";<br> }
cout <<"\n";<br> for (int i = 0; i < m; i++) {
y[i]=rand() % 20;
cout << y[i] << " ";<br> }
cout <<"\n";<br> for (int i = 0; i < n; i++)
if (x[i] == y[1]) k++;
cout << "k = " << k;<br> return 0;
}
Пример:
10 8
0 5 14 15 10 5 6 0 18 3
14 5 10 6 2 16 8 17
k = 2