#include<cstdio> #include<cstring> #include<cmath> using namespace std; int main(){ int m, n,i; double x, y; scanf("%d%d", &m, &n); x = m / (pow(2.0, n)); y = m; for (i = 1; i < n; i++) { y = y + m / pow(2.0, i-1); } printf("%.2lf %.2lf\n", x, y); return 0; } |
Double click to view unformatted code.