We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
void swap(int a[],int i,int j){
int temp;
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
int main(){
int m;
int n;
scanf("%d %d",&m,&n);
int A[10]={0};
A[m-1]=1;
for(int a0 = 0; a0 < n; a0++){
int a;
int b;
scanf("%d %d",&a,&b);
// your code goes here
swap(A,a-1,b-1);
Where's the Marble?
You are viewing a single comment's thread. Return to all comments →
include
include
include
include
include
include
include
void swap(int a[],int i,int j){ int temp; temp=a[i]; a[i]=a[j]; a[j]=temp;
}
int main(){ int m; int n; scanf("%d %d",&m,&n); int A[10]={0}; A[m-1]=1; for(int a0 = 0; a0 < n; a0++){ int a; int b; scanf("%d %d",&a,&b); // your code goes here swap(A,a-1,b-1);
}