View Code of Problem 118

#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    int n,sum,k=1;
    while(cin>>n){
        sum=0;
        if(n<=3)
            sum=5;
        else{
            if(n%2==0)
                sum=5+(n-3)*1.5+0.5;
            else
                sum=5+(n-3)*1.5;
        }
        cout<<"Case #"<<k++<<": "<<sum<<endl;
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 118