2 solutions

  • 0
    @ 2024-4-1 11:24:37

    #include

    using namespace std;

    int a[105][105]; int n,m; int x,y;

    int main(){ n = 5, m = 5; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) //i行j列 cin >> a[i][j]; cin >> x >> y;

    for (int j=1;j<=m;j++)
    	swap(a[x][j], a[y][j]);
    
    
    for (int i=1;i<=n;i++){
    	for (int j=1;j<=m;j++)	//i行j列
    		cout << a[i][j]<< " "; 
    	cout << endl;		
    }
    

    }

    • 0
      @ 2024-4-1 11:18:43

      #include

      using namespace std;

      int a[105][105]; int n,m; int x,y;

      int main(){ n = 5, m = 5; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) //i行j列 cin >> a[i][j]; cin >> x >> y;

      for (int j=1;j<=m;j++)
      	swap(a[x][j], a[y][j]);
      
      
      for (int i=1;i<=n;i++){
      	for (int j=1;j<=m;j++)	//i行j列
      		cout << a[i][j]<< " "; 
      	cout << endl;		
      }
      

      }

      • 1

      Information

      ID
      6914
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      1
      Tags
      # Submissions
      59
      Accepted
      45
      Uploaded By