View Code of Problem 118

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

Double click to view unformatted code.


Back to problem 118