View Code of Problem 118

#include<bits/stdc++.h>
using namespace std;
int main(){
	int op = 1,n;
	while(scanf("%d",&n)!=EOF){
		double sum = 0;
		if(n<=3){
			sum = 5;
		}
		else{
			sum += 5;
			n = n - 3;
			sum = sum + n * 1.5;
			sum = (ceil(sum));
		}
		printf("Case #%d: %.0lf\n",op,sum);
		op++;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 118