Project Euler – Problem 53

Problem 53: How many, not necessarily distinct, values of nCr, for 1 <= n <= 100, are greater than one-million?

class runner
{	
	public static void main (String[] args) throws java.lang.Exception
	{
		long time = System.currentTimeMillis();
 
		int[][] triangle = new int[98][98];//5+2=7, 98+2=100
		//setup
		for(int i=0;i<triangle.length;i++){
			triangle[0][i] = i+2;
			triangle[i][0] = i+2;
		}
 
		int count = 0;
		for(int j=1;j<triangle.length;j++){
			for(int i=1;i<=triangle.length-j;i++){
				int sum = triangle[j][i-1]+triangle[j-1][i];
				//System.out.print(sum+"\t");
				if(sum > 1000000){
					count += j-i+1;
					triangle[j][i] = 1000000;
					break;
				}
				triangle[j][i] = sum;
			}
			//System.out.println();
		}
		System.out.println("c:"+count);
 
		System.out.println("time: "+(System.currentTimeMillis() - time));
	}
}