View Code of Problem 118

#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
    int n;
    int cnt = 1;
    while(cin >> n){
        double sum = 0;
        sum += 5;
        if(n > 3){
            sum += (n - 3) * 1.5;
        }
        int ans = (int)(sum + 0.5);
        printf("Case #%d: %d\n", cnt, ans);
        cnt++;
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 118