#include<stdio.h> int main() { int M,N; scanf("%d%d",&M,&N); double h=M,sum=M,temp=0; for(int i=0;i<N;i++) { h/=2.0; sum+=2*temp; temp=h; } printf("%.2lf %.2lf",h,sum); return 0; }
Double click to view unformatted code.