提交时间:2019-12-17 19:52:47
运行 ID: 3467
#include<iostream> using namespace std; int main(){ int m,n,x,y; cin>>m; cin>>n; int a[m][n]; for(int i=0;i<=m-1;i++){ for(int j=0;j<=n-1;j++){ cin>>a[i][j]; } } cin>>x; cin>>y; if(x>=1&&x<=n&&y>=1&&y<=n){ x--; y--; for(int i=0;i<=n-1;i++){ int t; t=a[i][x]; a[i][x]=a[i][y]; a[i][y]=t; } for(int i=0;i<=m-1;i++){ for(int j=0;j<=n-1;j++){ cout<<a[i][j]<<" "; } cout<<"\n"; } } return 0; }