Run Time Error(NZEC) in java..plz help

import java.io.*;

public class SumInTriangle {
	public static void main(String args[]) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int[][] arr=new int[100][100];
	
	int testcases =Integer.parseInt(br.readLine());
	
	while(testcases>0)
	{
	
	int n = Integer.parseInt(br.readLine());
	for(int i=0;i<n;i++)
	{
	for(int j=0;j<=i;j++)
	arr[i][j]= Integer.parseInt(br.readLine());
	}
	for(int i=n-2;i>=0;i--)
	{
	for(int j=0;j<=i;j++)
	{
	arr[i][j]+=arr[i+1][j]>arr[i+1][j+1]?arr[i+1][j]:arr[i+1][j+1];
	}
	}
	System.out.printf("%d\n",arr[0][0]);
	testcases--;
	}
	

	} 

}

I am getting a Run Time Error(NZEC) in this program…although it is working in my eclipse and giving correct output…plz help…
If any extra code line is needed or any new concept…plz explain it…because I am new to java and learning it…plz help…

Take this as a hint…
The problem you are getting is while taking input!!While running on ideone,it gives number format exception!!
Here is a link link text
Number format exception occurs when u try to convert a string into Number and when string is not appropriate.
The string should not contain any blank spaces…Hope this helps…
Try some other method as an input!!

2 Likes

I think @shivam217 is trying to solve SUMTRIAN.

@shivam217 It’s giving NZEC error because of this line: arr[i][j]= Integer.parseInt(br.readLine());
In the input you’ll have to read multiple numbers in a single line. That code only works when the line you’re currently reading only has one number and nothing else.

1 Like

can u pls provide the problem link!!!

here is problem link:

@kunal361 link of my solution is http://www.codechef.com/viewsolution/2300790

I havent checked your logic!!..Here is ur same code with different input technique!! http://ideone.com/3zI4Cl

@jaythegenius thanks for the link…It really helped me…thank u very much…

Yeah No problem!!