View Code of Problem 118

import java.util.*;
public class Main {
	 public static void main(String[] args) {
		 Scanner in = new Scanner(System.in);
		 int count=1;
		 while(in.hasNext()){
			 int n =in.nextInt();
			 double m = 0;
			 if(n<=3) {
				 m=5;
			 }else if((n-3)%2==0){
				 m=5+(n-3)*1.5;
			 }else {
				 m=5+(n-3)*1.5+0.5;
			 }
			 System.out.println("Case #"+(count++)+": "+String.format("%.0f", m));
		 }
	 }
}

Double click to view unformatted code.


Back to problem 118