// //
}
List return b; public static void main(String[] args) { List b.set(i, a); // 填空 b.remove(i); b.add(a); a = t; lst.addAll(Arrays.asList(12,127,85,66,27,34,15,344,156,344,29,47)); System.out.println(max5(lst)); } } 程序题: 1. import java.util.Scanner; public class C1 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner reader = new Scanner(System.in); String s1 = reader.nextLine(); String s2 = reader.nextLine(); int x[] = getX(s1, s2); int y[] = getY(s1, s2); int a[] = x; int b[] = y; union(a, b); System.out.println(minX(x)+\+minX(y)+\+(maxX(x)-minX(x))+\+(maxX(y)-minX(y))); } static void union(int x[],int y[]) { int a[]= new int[4]; int b[] = new int[4]; for(int i = 0;i<4;i++) { a[i] = x[i]; } int uX = secondMin(a); boolean xb = (uX<=Math.max(x[0], x[1])&&uX>=Math.min(x[1],x[0]))&&(uX<=Math.max(x[2],x[3])&&uX>=Math.min(x[2], x[3])); for(int i = 0;i<4;i++) { b[i] = y[i]; } int uY = secondMin(b); boolean yb = (uY<=Math.max(y[0], y[1])&&uY>=Math.min(y[1],y[0]))&&(uY<=Math.max(y[2],y[3])&&uY>=Math.min(y[2], y[3])); if(xb&&yb&&((a[1]-a[2])!=0&&(b[1]-b[2])!=0)) { } System.out.println(uX+\+uY+\+(a[1]-a[2])+\+(b[1]-b[2])); else { } System.out.println(\不存在\); } static int[] getX(String s1,String s2) { String ss1[] = s1.split(\); String ss2[] = s2.split(\); int xy[] = new int[4]; xy[0] = Integer.parseInt(ss1[0]); xy[1] = Integer.parseInt(ss1[2]); xy[2] = Integer.parseInt(ss2[0]); xy[3] = Integer.parseInt(ss2[2]); return xy; } static int[] getY(String s1,String s2) { } static int maxX(int x[]) { int temp; for(int i = 0;i <= 2;i++) } { if(x[i]>x[i+1]) { } temp = x[i]; x[i] = x[i+1]; x[i+1] = temp; String ss1[] = s1.split(\); String ss2[] = s2.split(\); int xy[] = new int[4]; xy[0] = Integer.parseInt(ss1[1]); xy[1] = Integer.parseInt(ss1[3]); xy[2] = Integer.parseInt(ss2[1]); xy[3] = Integer.parseInt(ss2[3]); return xy; } return x[3]; static int minX(int x[]) } 2. { int temp; for(int i = 0;i <= 2;i++) { } if(x[i] temp = x[i]; x[i] = x[i+1]; x[i+1] = temp; return x[3]; } static int secondMin(int x[]) { } int temp; for(int i = 0;i<3;i++) for(int j = 0;j { } temp = x[j]; x[j] = x[j+1]; x[j+1] = temp; return x[2]; public class C2 { public static void main(String[] args) { // TODO Auto-generated method stub //String string = \ char a[] = {' ','+','-'}; char num[] = {'1','2','3','4','5','6','7','8','9'}; for(char x1:a) for(char x2:a) for(char x3:a) { for(char x4:a) for(char x5:a) for(char x6:a) for(char x7:a) for(char x8:a) int result = 0; char s[] = {x1,x2,x3,x4,x5,x6,x7,x8}; String string = \; for(int i = 0;i<= 7;i++) { } string = string+num[8]; string= string.replaceAll(\,\); String jianString[] = string.split(\); int addResult[] = new int[jianString.length]; addResult[0] = 0; String addString[] = jianString[0].split(\); for(int j = 0;j addResult[0] += Integer.parseInt(String.valueOf(addString[j])); } result = addResult[0]; for(int i = 1;i String num1[] = jianString[i].split(\); result = result - Integer.parseInt(String.valueOf(num1[0])); string = string+num[i]+s[i]; } for(int p = 1;p result += Integer.parseInt(String.valueOf(num1[p]));