include iostream using namespace std int main size_t dimension cout En

 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <iostream>
using namespace std;
int main() {
/*
size_t dimension;
cout << "Enter lists (AL, I, J) dimension: ";
cin >> dimension;
int AL[dimension], I[dimension], J[dimension];
for (int _i = 0; _i < dimension; ++_i) {
cout << "Enter AL[" << _i << "]: " << endl;
cin >> AL[_i];
}
for (int _i = 0; _i < dimension; ++_i) {
cout << "Enter I[" << _i << "]: " << endl;
cin >> I[_i];
}
for (int _i = 0; _i < dimension; ++_i) {
cout << "Enter J[" << _i << "]: " << endl;
cin >> J[_i];
}
// убрать многострочный комментарий для ручного ввода списков и закомментировать код ниже
*/
int AL[] = {5, 2, 7, 4, 6, 1, 3, 9},
I[] = {1, 1, 2, 3, 3, 3, 4, 4},
J[] = {2, 3, 3, 2, 4, 5, 2, 5};
size_t dimension = (sizeof(AL) / sizeof(*AL));
int i, j;
cout << "Enter i: " << endl;
cin >> i;
cout << "Enter j: " << endl;
cin >> j;
int result = 0;
for (int _i = 0; _i < dimension; ++_i) {
if (i == I[_i] and j == J[_i]) {
result = AL[_i];
}
}
cout << "Result: " << endl << result << endl;
return 0;
}