合并 import java.util.Scanner;public class Test3 { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int l = scan.nextInt(); //长度 int m = scan.nextInt(); // int[] a = new int[m]; int[] b = new int[m]; int
import java.util.Scanner;
public class Test3 {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int l = scan.nextInt(); //长度
int m = scan.nextInt(); //
int[] a = new int[m];
int[] b = new int[m];
int i,j;
for (i=0; i
i; j--){
if(a[i]>a[i+1]){
temp = a[i];
a[i] = a[i+1];
a[i+1] = temp;
temp = b[i];
b[i] = b[i+1];
b[i+1] = temp;
}
}
}
}catch(Exception e){
}
int max = b[0]-a[0]+1;
for(i=1; i
b[i-1]){ max = max+b[i]-a[i]+1; }else{ if(b[i]
