解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
static
Scanner sc = new Scanner(System.in);
public static void C(int M,int[] array){
for(int i=0;i<M;i++){
int A = sc.nextInt();
int B = sc.nextInt();
int temp = array[A-1];
array[A-1] = array[B-1];
array[B-1] = temp;
}
for(int i=0;i<array.length;i++){
System.out.println(array[i]);
}
}
public static void main(String[] arg){
int N = sc.nextInt();
int M = sc.nextInt();
int[] array = new int[N];
for(int i=0;i<N;i++){
array[i] = sc.nextInt();
}
C(M, array);
}
}
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:483 |
wu-淘淘的名单 (C++代码)浏览:703 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:408 |
哥德巴赫曾猜测 (C语言代码)浏览:1242 |
1014题解浏览:396 |
字符逆序 (C语言代码)浏览:376 |
图形输出 (C语言代码)浏览:1068 |
C语言程序设计教程(第三版)课后习题10.3 (C语言代码)浏览:466 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:266 |
【C语言训练】大、小写问题 (C语言代码)浏览:593 |