View Code of Problem 72

#include<iostream>
#include<cmath>
#include<string.h>
#include<algorithm>
using namespace std;
#pragma warning(disable:4996)


int main() {
	double n;
	int m;
	scanf("%lf %d", &n, &m);
	double temp = n;
	double sum = n;
	for (int i = 0; i < m; i++) {
		temp = temp / 2;
		sum = temp * 2 + sum;
	}
	sum = sum - temp * 2;
	printf("%.2lf %.2lf", temp, sum);
	return 0;	
}

Double click to view unformatted code.


Back to problem 72