I hope it is ok to be pasting the code as it is the very first problem.
import java.util.*;
public class Ladders1{
public static void main(){
Scanner sc = new Scanner(System.in).useDelimiter("\n");
int t = sc.nextInt();
int a=0,b=0,c=0;
for(int i=0;i<t;i++){
String cords = sc.next();
String[] xyz = cords.split(" ",0);
a+=Integer.parseInt(xyz[0]);
b+=Integer.parseInt(xyz[1]);
c+=Integer.parseInt(xyz[2]);
}
if(a==0 && b==0 && c==0){
System.out.println("YES");
} else{
System.out.println("NO");
}
}
}
Would really appreciate your input as I've been trying to find the issue to no avail.
maybe that your compiler is old
I don't think so. Because both use java8
sometimes java sucks i also got so many problems like this
Don't use delimiter. Just read your coordinates using
sc.nextInt()
three times, it can itself skip all new-line characters and spaces.I think that the issue with your case is that Codeforces uses Windows, so the endline is
"\r\n"
.