Getting NZEC in java ??

package practice;
import java.util.Scanner;

class Cricket
{    
    /**
     * @param args
     */
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        //  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner br = new Scanner(System.in);
        int t;
        //t=Integer.parseInt(br.readLine());
        t=br.nextInt();
        while((t--)!=0)
        {
            int n;
            // n=Integer.parseInt(br.readLine());
            n=br.nextInt();
            int[] res = new int[n];
            for(int i=0; i<n; i++)
            {
                int num;
                // num = Integer.parseInt(br.readLine());
                num=br.nextInt();
                res[i] = res[i] + (num*3);
            }
            for(int i=0; i<n; i++)
            {
                int num;
                // num = Integer.parseInt(br.readLine());
                num=br.nextInt();
                res[i] = res[i] + num;
            }
            System.out.println(Cricket.max(res,n));
        }
    }

    static int max(int[] res,int n)
    {
        int result =0;
        for(int i=0; i<n; i++)
        {
            if(res[i]>result)   result=res[i];
        }
        return result;
    }
}

Cant figure out why am getting NZEC ? Code run’s fine on my system …

I’m not familiar with java so the only thing i can suggest right now is to refer to this FAQ (incase you haven’t) and hope some regular Java programmer like @betlista or @junior94 comes along to help.

And please post a link to the problem statement from next time.Here is link to the problem statement : link

try putting the enitre code between try ,catch and in catch just put return; don’t return anything

//package practice; <— hide this line, as codechef judge can’t find the package for you!

Try submitting now!

6 Likes

thanks got Accepted …