Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<math.h>
- using namespace std;
- const int N = 1e4;
- bool used[N][N];
- int a[N][N];
- int b[N];
- int sz;//size
- int n;
- void BitToRigth(int k)
- {
- for (int j = sz; j > k; j--)
- for (int i = 0; i < n; ++i)
- a[i][j] = a[i][j - 1];
- }
- void PushToCow(int k)
- {
- for (int i = 0; i < n; ++i)
- a[i][k] = b[i];
- }
- int main()
- {
- cout << "n = ";
- cin >> n;
- sz = n;
- cout << "Matrix = \n";
- for (int i = 0; i < n; ++i)
- for (int j = 0; j < n; ++j)
- cin >> a[i][j];
- cout << "vvedite 4islo ";
- int g;
- cin >> g;
- cout << "vvedite massiv vstavki \n";
- for (int i = 0; i < n; ++i)
- cin >> b[i];
- for (int j = 0; j < sz; j++)
- for (int i = 0; i < n; ++i)
- if (a[i][j] == g)
- {
- BitToRigth(j);
- PushToCow(j);
- sz++;
- j++;
- break;
- }
- for (int i = 0; i < n; ++i)
- {
- for (int j = 0; j < sz; ++j)
- cout << a[i][j] << ' ';
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement