publicstaticintgetValue(int i){int result =0;switch(i){case1:
result = result + i;case2:
result = result + i *2;case3:
result = result + i *3;}return result;}
3. 如下代码输出值为多少?
publicclassBase{privateString baseName ="base";publicBase(){callName();}publicvoidcallName(){System. out.println(baseName);}staticclassSubextendsBase{privateString baseName ="sub";publicvoidcallName(){System.out.println(baseName);}}publicstaticvoidmain(String[] args){Base b =newSub();}}
publicstaticvoidmain(String[] args){int[] num ={1,2,2,3,4,5,6,7,8,9};int sum =10;int i =0;int j = num.length -1;while(i < j){if( num[i]+ num[j]> sum){
j --;}if( num[i]+ num[j]< sum){
i ++;}if( num[i]+ num[j]== sum){System.out.println(num[i]+"---"+ num[j]);}
i ++;}}
方案二:即给定数字限定为:7
publicstaticvoidmain(String[] args){int[] num ={1,2,2,3,4,5,6,7,8,9};int sum =7;findSum(num,sum);}privatestaticvoidfindSum(int[] num,int sum){int left=0;int right=0;for(int i=0;i<num.length;i++){int curSum =0;
left = i;
right = i;while(curSum<sum){
curSum += num[right++];}if(curSum==sum){for(int j=left;j<right;j++){System.out.print(num[j]+" ");}System.out.println();}}}
▶ 一、实验室信息管理系统(LIS)是什么? 实验室信息管理系统也就是平时所说的LIS(Laboratory Information System)系统,其主要服务的对象主要是医院检验科工作人员,也是医院信息化建设必…