第三届全国软件大赛java高职预赛题答案(全)
仅供参考!
1.
public class A1 { public static void main(String[] args) { //答案为:3789.86 double AB = 52.1, BC = 57.2, CD = 43.5, DE = 51.9, EA = 33.4, EB = 68.2, EC = 71.9; System.out.println(mianji(AB, EB, EA) + mianji(EB, BC, EC) + mianji(EC, CD, DE)); } static double mianji(double a,double b,double c) { double s = (a + b + c)/2; return Math.sqrt(s * (s - a)*(s -b)*(s - c)); } }
2.
public class A2 { //答案:19550604 有点不确定 供参考 觉得算法没什么问题 public static void main(String[] args) { int a[] = gbs(); int i = 0; while(i <= a.length) { if(String.valueOf(a[i]).contains("06")&&String.valueOf(a[i]).contains("19")) System.out.println(a[i]); i++; } } static int[] gbs() { int d[] = new int[5030]; int j = 0; for(int i = 10000;i * 2012 >= 10000000; i--) { d[j] = i * 2012; j++;