import java.io.*; /** * 规律: * 高度 1000,第 5 次: * 1000 / 2 / 2 / 2 / 2 / 2 = 31.25 * 1000 + 500 * 2 + 250 * 2 + 125 * 2 + 62.5 * 2 = 2875 */ public class Main { public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); public static StreamTokenizer cin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); public static PrintWriter cout = new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) throws Exception { double height; int n; cin.nextToken(); height = cin.nval; cin.nextToken(); n = (int) cin.nval; double l = 0; for (int i = n; i > 0; i--) { if (i != n) { l += height; } height /= 2; l += height * 2; } cout.printf("%.2f %.2f", height, l); cout.flush(); } }
0.0分
0 人评分
素数判断模板题(题解中的函数能用来判断大数是不是素数)浏览:892 |
C语言程序设计教程(第三版)课后习题8.7 (C++代码)浏览:856 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:623 |
C语言训练-斐波纳契数列 (C语言代码)浏览:826 |
点我有惊喜!你懂得!浏览:2248 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C++代码)(手动优化一下计算)浏览:1365 |
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:583 |
Cylinder (C语言描述+详细分析)浏览:3375 |
罗列完美数 (C语言代码)浏览:519 |
C二级辅导-分段函数 (C语言代码)浏览:659 |