解题思路:
注意事项:
参考代码:package com.test.eazy;
import java.util.Scanner;
public class eazy14 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String s = sc.nextLine();
int c = s.charAt(1)-'0';
int length = 1189;
int high=841;
int [][]sum=new int[10][2];
sum[0][0]=length;
sum[0][1]=high;
if(c==0){
System.out.println( sum[0][0]);
System.out.println( sum[0][1]);
}
for (int i = 1; i <=9; i++) {
if(length>high){
length=(int)Math.floor((double) length/2);
sum[i][0]=Math.max(length,high);
sum[i][1]=Math.min(length,high);
}else {
high=(int)Math.floor((double) high/2);
sum[i][0]=Math.max(length,high);
sum[i][1]=Math.min(length,high);
}
if(i==c){
System.out.println(sum[i][0]);
System.out.println(sum[i][1]);
}
}
}
}
0.0分
0 人评分