View difference between Paste ID: 7XXNW5km and Smk8xhPB
SHOW: | | - or go back to the newest paste.
1-
90.4.20
1+
92.4
2
#include<iostream>
3
#include<math.h>
4
using namespace std;
5
6
const int N = 1e4;
7
8
bool used[N][N];
9-
bool used[N][N]; // статичная матрица логического типа
9+
10
int a[N][N];
11-
int a[N][N]; // статичная матрица
11+
int b[N];
12-
int answer[2 * N];
12+
int sz;//size
13
int n;
14
void BitToRigth(int k)
15
{
16-
    int n; 
16+
    for (int j = sz; j > k; j--) 
17-
	cout << "Enter n: " << endl;
17+
18
            a[i][j] = a[i][j - 1]; // расширение массива
19-
	cout << "Enter matrix: " << endl;
19+
}
20
void PushToCow(int k)
21
{
22
    for (int i = 0; i < n; ++i)
23-
    int cnt = 0;
23+
        a[i][k] = b[i]; // вставка нового столбца
24-
    for (int j = 0; j < n; ++j)
24+
}
25
int main()
26-
            {
26+
27-
                int cur = a[i][j]; 
27+
    cout << "n = ";
28-
                if (used[j][cur] == true)
28+
29-
                    {
29+
    sz = n;
30-
                        for (int k = 0; k < i; k++)
30+
    cout << "Matrix = \n";
31-
                            if (a[k][j] == cur)
31+
32-
                                {
32+
33-
                                    answer[cnt++] = k;
33+
34-
                                    break;
34+
    cout << "vvedite 4islo ";
35-
                                }
35+
    int g;
36-
                        answer[cnt++] = i;
36+
    cin >> g;
37-
                        break;
37+
    cout << "vvedite massiv vstavki \n";
38-
                    }
38+
39-
                else
39+
        cin >> b[i];
40-
                    used[j][cur] = true;
40+
    for (int j = 0; j < sz; j++)
41-
            }
41+
        for (int i = 0; i < n; ++i) // проход по транспонированному массиву
42-
    for (int i = 0; i < cnt; i += 2)
42+
            if (a[i][j] == g)
43-
        cout << answer[i] + 1<< ' ' << answer[i + 1] + 1 << endl;
43+
                {
44-
	system ("pause");
44+
                    BitToRigth(j);
45-
	return 0;
45+
                    PushToCow(j);
46-
}
46+
                    sz++; // увеличение размерности массива
47
                    j++;
48
                    break;
49
                }
50
51
    for (int i = 0; i < n; ++i)
52
    {
53
        for (int j = 0; j < sz; ++j)
54
            cout << a[i][j] << ' ';
55
        cout << endl;
56
    }
57
system ("pause");
58
return 0;}