View Code of Problem 115

#include<stdio.h>
int money(int x) {
	if (x==1)
	{
		return 1;
	}
	else
	{
		return 2 * money(x - 1);
	}
	
}
int main() {
	int n;
	while (scanf("%d", &n)!=EOF)
	{
		int count = 0;
		for (int i = 1; i <=n; i++)
		{
			int day_money = money(i);
			count += day_money;
		}
		printf("%d %d\n", count, n * 100000);
	}
	
}

Double click to view unformatted code.


Back to problem 115