#include<stdio.h> int main() { int m,n,i; double high,s=0; scanf("%d %d",&m,&n); high=(double)m; for(i=0;i<n;i++) { s+=high; high/=(double)2; if(i!=n-1) s+=high; } printf("%.2lf %.2lf",high,s); }
Double click to view unformatted code.