View Code of Problem 118

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<climits>
#include<cmath>
#include<map>
#include<set>

using namespace std;


int main()
{
	int n;
	int num = 1;
	while (cin >> n) {

		double money = 5;

		if (n <= 3) {

			cout << "Case #" << num << ": " << money << endl;
			num++;
			continue;
		}

		else {

			n = n - 3;

			while (n > 0) {

				money += 1.5;
				n--;
			}
		}

		money = ceil(money);
		cout << "Case #" << num << ": " << money << endl;

		num++;
	}
}

Double click to view unformatted code.


Back to problem 118