View Code of Problem 118

#include<iostream>
using namespace std;
int main(){
	int n;
	int k=0;
	while(cin>>n){
		int cash;
		if(n<=3){
			cash=5;
			k++;
			printf("Case #%d: %d\n",k,cash);
		}
		else if(n>3){
			cash=(n-3)*3;
			cash=(cash+1)/2;
			cash=cash+5;
			k++;
			printf("Case #%d: %d\n",k,cash);
		}
	}
}

Double click to view unformatted code.


Back to problem 118