Why do I get an NZEC?

@the_darklord

I am not familiar with JAVA but when i run your code on ideone on giving test cases, your code returns stderr

Exception in thread "main" java.lang.NumberFormatException: For input string: "3 6"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:492)
	at java.lang.Short.parseShort(Short.java:117)
	at java.lang.Short.parseShort(Short.java:143)
	at ClosingTweet.main(Main.java:14)

Link : http://ideone.com/g1HO2W

1 Like

i have used raw_input().split() method but still getting a nzec.why??
can anyone help me

1 Like

Why I am getting NZEC error while using BufferedReader Input in JAVA for my solution??(while scanner type input is accepted)

1 Like

hi,

i keep getting NZEC and would like to know if there is a way i can get the inputs used for testing my code.
this is my code http://www.codechef.com/viewsolution/5778355

thanks
Sivan

I’ve searched through forums and similar code but I’m still getting NZEC. I suspect it could be something with input/output or an index going out of bounds on an array. Any suggestions? CodeChef: Practical coding for everyone

http://www.codechef.com/viewsolution/6345015
why NZEC in java code ??? any help please

My python code is encountering the NZEC error.

How will my code be able to receive multiple input from single line, if those inputs are in the form of an array.

Please tell me what to change in this piece of code, to be able to accept an array of inputs from the user.

pies=[]

for j in range(0,np):

pies.append(int(raw_input()))

This is the code to receive input if they are printed on consecutive lines.
The problem is that all the inputs are being entered on the same line, but how do i receive the array of inputs from the same line?

why i m getting NZEC in C code i have written the statement return 0;

My all programs give NZEC error when submitting when using C#.
All the programs work perfectly with IDE. Any help ?
It’s a shame there’s no support for this problem.

3 Likes

can you please specify which language.

Using Python here. I have used raw_input(), split() , etc. and all that has been suggested here. Still, I am getting this error. Any ideas why ?
I am on the Alien Chefs problem.

2 Likes

public class SumOfDigits{
public static void main(String args[]){
Scanner sc= new Scanner(System.in);
System.out.println(“Enter a number”);
int number = sc.nextInt();
int sum = 0;
int input = number;
while(input!=0){
int x = number%10;
sum+=x;
input=number/10;
}
System.out.println(sum);
sc.close();
}
}

What is wrong with my code? It shows NZEC runtime error.

for z in range(int(raw_input())):

na = raw_input()

seq = str(raw_input())

na = raw_input()

seqf = str(raw_input())

flag = 'Yes'

for i in seqf:

    if i not in seq:

        flag = 'No'

print (flag) 

why am I getting NZEC error in this one?

what is error in this code :

m=n=k=t=0
res=[]
inp = ""


t=int(input())
while t:
	inp=raw_input()
	m=int(inp[0])
	n=int(inp[2])
	k=int(inp[4])
	while k:
		if m>n :
			n+=1
			k-=1
		elif n>m:
			m+=1
			k-=1
		else:
			break
	res.append(abs(m-n))
	t-=1

for out in res:
	print out

for the chef with fruits problem?

I am getting this error in JAVA. The code works fine on my local IDE(BlueJ).
For this problem: RRCOPY Problem - CodeChef
My solution: CodeChef: Practical coding for everyone

My python code is running good in my laptop but when submitted in codechef it is throwing run time NZEC error. My code is:

n = int(raw_input())
a = []
while n>0:
	p,q = map(int, raw_input().split())
	c = max(p,q)
	a.append(c**2)
	n = n-1
d = sum(a)
e = int(d**(.5))
print e
3 Likes

Getting an NZEC error for a java code.
Here is the link to it, please check to see where i am makinga mistake.
Thanks
https://www.codechef.com/viewsolution/9505127

getting NZEC for this code.Can anyone will help me?

import java.util.*;
class BUY1GET1
{
public static void main(String args[])
{
int t;
Scanner s = new Scanner(System.in);
t=s.nextInt();
s.nextLine();
while(t–>0)
{
String j = s.nextLine();
//System.out.println(j+“”);
int sum=0,l=j.length();
int a[]=new int[26];
for(int i=0;i<l;i++)
{
a[(int)j.charAt(i)-97]++;
}
for(int i=0;i<26;i++)
{
//System.out.println(a[i]);
if(a[i]%2==0)
sum =sum + a[i]/2;
else
sum= sum + (a[i]+1)/2;
}
System.out.println(sum);

	}
}

}

1 Like

Here is my java code.
Why do I get an NZEC?

import java.util.Scanner;

public class Main{
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
String lines = reader.nextLine();
String[] strs = lines.trim().split("\s+");
int a[] = new int[50];
for (int i = 0; i < 2; i++) {
a[i] = Integer.parseInt(strs[i]);
}
if ((a[0] > a[1] - 0.5) || (a[0] % 5 != 0)) {
System.out.println(a[1]);
} else {
System.out.println(a[1] - (a[0] + 0.5));
}

}

}

I just started doing code chef and am quite new to competitive coding.
i tried 8 questions back to back using Java , which were working good in Netbeans in my laptop.
none of them got successful submision.
each had same problem.
NZEC Error!!!
This is confidence loosening.
PLEASE SOMEONE HELPPPPPP.!!!

2 Likes