给定两个数R和n,输出R的n次方,其中0.0<R<99.999, 0<n<=25
多组测试用例,请参考例题的输入处理 输入每行一个浮点数 R 其中0.0 < R <99.999, 一个整数 n 其中0 < n <=25
输出R的n次方
95.123 12 0.1 1
548815620517731830194541.899025343415715973535967221869852721 0.1
import java.io.IOException; import java.math.BigDecimal; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] tmp = br.readLine().split(" "); if (tmp.length > 3){ int b = Integer.parseInt(tmp[1]); int d = Integer.parseInt(tmp[3]); BigDecimal a = new BigDecimal(tmp[0]); BigDecimal c = new BigDecimal(tmp[2]); BigDecimal num1 = a; BigDecimal num2 = c; for (int x = 1; x < b; x++) { num1 = num1.multiply(a); } for (int x = 1; x < d; x++) { num2 = num2.multiply(c); } System.out.println(num1 + " " + num2); } } }