View Code of Problem 118

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>

int main() {
	int Case = 0;
	int money;
	
	long n;
	
	while(~scanf("%ld", &n)) {
		money = 5;
		Case ++; 
		if(n > 3) {
			if(n % 2 == 0) {
				money += ((n - 3) * 1.5 + 1);
			} else if(n % 2 != 0) {
				money += ((n - 3) * 1.5);
			}
		} 
		printf("Case #%d: %d\n", Case, money);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 118