#include<stdio.h> int main(){ int M, N; scanf("%d%d",&M,&N); int i; float sum = 0.0, high = (float)M; for(i = N; i > 0; i --){ sum = sum + high; high = high / 2; if(i != 1) sum = sum + high; } printf("%.2f %.2f\n",high,sum); return 0; } |
Double click to view unformatted code.