1 条回复
package exam.meitu.test;
import java.util.Scanner;
/**
* [@author](/user/author) steven
*
* 2017-04-16 下午7:44:33
*
* 类说明:
*/
public class Main2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int H, L;
while (sc.hasNext()) {
int num;
H = sc.nextInt();
L = sc.nextInt();
if (1 <= H && H <= 100000 && 1 <= L && L <= 100000) {
if (H == L) {
num = 1;
} else if (H > L) {
num = 0;
} else if ((2 * H - L) < 0) {
System.out.println("no");
continue;
} else {
num = (int) (Math.log(H / (2 * H - L)) / Math.log(2) + 1);
}
System.out.println(num);
}
}
}
}
添加回复