package dancinggooglers;

import java.io.File;
import java.util.Scanner;

public class DanceScoreCalculator {


    public static void main(String[] args) {
        if(args.length <= 0 || args[0] == null) {
            System.out.println("You must enter a file to read");
            System.out.println("Usage: blah <filename>");
            System.exit(0);
        }

        File argFile = new File(args[0]);
        try {
            Scanner googleSpeakScanner = new Scanner(argFile);
            String firstLine = googleSpeakScanner.nextLine();
            Integer linesToScan = new Integer(firstLine);
            for(int i = 1; i <= linesToScan; i++) {
                String googleDancerLine = googleSpeakScanner.nextLine();
                DanceScoreCase danceCase = new DanceScoreCase(googleDancerLine);
                System.out.println(String.format("Case #%d: %d", i, danceCase.maxDancersThatCouldPass()));
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

package codejam;

public class Triplet {

	private int total;
	private int mod3;
	private int div3;
	private int maxNormal;
	private int maxSurprise;

	public Triplet(int totalPoints) {
		init(totalPoints);
	}

	private void init(int totalPoints) {
		total = totalPoints;
		mod3 = total % 3;
		div3 = total / 3;
		maxNormal = calcMaxNormal();
		maxSurprise = calcMaxSurprise();
	}

	public int calcMaxSurprise() {
		if ( total == 0 ) return 0;
		return (mod3 == 2) ? div3 + 2 : div3 + 1;
	}

	public int calcMaxNormal() {
		if ( total == 0 ) return 0;
		return (mod3 == 0) ? div3 : div3 + 1;
	}

	public int getMaxNormal() {
		return maxNormal;
	}

	public int getMaxSurprise() {
		return maxSurprise;
	}

	public static void main(String[] args){
		System.out.println("Testing Triplet");
		for ( int i=0; i<6; i++ ) {
			Triplet t = new Triplet(i);
			System.out.println(i+" n:"+t.calcMaxNormal() + " s:" + t.calcMaxSurprise());
		}
	}
}
