#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define max 3000
#define row 1001
#define col 1001
#define N 8
/*
假设一个球从任意高度自由落下,每次落地后反跳回原高度的一半; 再落下, 求它在第5次落地时,共经历多少米?第5次反弹多高?
最后的误差判断是小数点6位
输入起始高度,int型
分别输出第5次落地时,共经过多少米第5次反弹多高
*/
/*
h - height
x - count
y - total
z - last height
*/
void calc(float h, int x, float* y, float* z)
{
if (x > 0)
{
x--;
*y += h + h / 2;
*z = h / 2;
calc(*z, x, y, z);
}
return;
}
int main()
{
char s[max];
char d[max];
char ss[N][col];
int seq[N];
int cnt[N];
int i = 0, j = 0, k = 0, m = 0, n = 0;
char a, b, c;
float x = 0, y = 0, z = 0;
while (scanf("%d", &i) != EOF)
{
x = i;
y = 0;
z = 0;
calc(x, 5, &y, &z);
printf("%f\n%f\n", y - z, z);
}
return 0;
}