#include<stdio.h> #include <stdlib.h> #include <string.h> int main() { int n; double m,h,d=0; scanf("%lf %d",&m,&n); while(n--){ h=m/2.0; d+=h+m; m=h; } d-=h; printf("%.2lf %.2lf",h,d); return 0; }
Double click to view unformatted code.