import java.text.DecimalFormat; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for (int i = 0; i < n; i++) { double h = scanner.nextDouble(); int t = scanner.nextInt(); //题意: 计算从小球H 高度下落到第n 次弹地往返的总路程 double sum =0; for (int j = 0; j < t-1; j++) { sum+=h*1.5; h/=2; } sum+=h; DecimalFormat f = new DecimalFormat("0.00"); System.out.println(f.format(sum)); } } }