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)
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
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?
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.
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.
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.
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