第三届蓝桥杯全国软件大赛java本科组预赛答案完整版(2)

2019-08-29 22:44

// //

}

List b = max5(lst); //List b = lst; for(int i=0; i

return b;

public static void main(String[] args) {

List lst = new Vector(); int t = b.get(i); if(a>t) { }

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]));


第三届蓝桥杯全国软件大赛java本科组预赛答案完整版(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:关于审理公司法人人格否认案件的若干意见

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: