Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

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

$
0
0
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..


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>