Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main(){
- // ввод
- int n,m,x;
- cout<<"n = ";
- cin >> n;
- cout<<"m = ";
- cin >>m;
- cout<<"x = ";
- cin>>x;
- cout << "vvedite massiv a " << endl;
- int **a = new int*[n * 2];
- for (int i = 0; i < n; i++){
- a[i] = new int[m * 2];
- for (int j = 0; j < n; j++){
- cin >> a[i][j];
- }
- }
- // тело программы
- for(int j= 0; j<m;j++){
- int summa = 0;
- for(int i=0;i<n;i++){
- summa = summa+a[i][j];
- }
- if(summa==x){
- for(int u=0;u<n;u++){
- for(int g=j;g < m - 1;g++){
- a[u][g]=a[u][g+1];
- }
- }
- m--;
- j--;
- }
- }
- // вывод массива
- cout << endl;
- cout << "Otvet:" << endl;
- for (int i = 0; i < n; i++){
- for (int j = 0; j < m ; j++){
- cout << a[i][j] << ' ';
- }
- cout << endl;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement