无聊,刷水题练下java
import java.util.*; public class Main { public static void main(String[] args){ Scanner cin=new Scanner(System.in); double n; int m; while(cin.hasNext()) { n=cin.nextDouble(); m=cin.nextInt(); double sum=n; for(int i=0;i<m-1;i++) { sum+=Math.sqrt(n); n=Math.sqrt(n); } System.out.printf("%.2f",sum); System.out.println(); } } }
时间: 2024-12-31 03:57:16