View Code of Problem 118

#include<stdio.h>
#include<math.h>
void main()
{
	int n,k=1;
	while(scanf("%d",&n)!=EOF)
	{
		double money;
		if(n<=3)
			printf("Case #%d: 5\n",k++);
		else
		{
			money=(n-3)*1.5+5;
			if(n%2==0)
				money=(int)money+1;
			printf("Case #%d: %d\n",k++,(int)money);
		}
			
	}
}

Double click to view unformatted code.


Back to problem 118