View Code of Problem 72

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
	int M,N,i;
	double h,s=0;
	scanf("%d %d",&M,&N);
	if(N==1) printf("500 1000");
	else{
	h=pow(0.5,N)*M;
	for(i=1;i<N;i++){
		s+=pow(0.5,i)*M*2;
	}
	
	printf("%.2f %.2f",h,s+1000);
	}

}

Double click to view unformatted code.


Back to problem 72