728x90
인텔리제이에서 돌리면 작동 잘하는데 백준에서 런타임 에러 (NoSuchElement) 발생

 

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine(),",");


int x = 0;
int y = 0;
while(st.hasMoreTokens()){
    x = Integer.parseInt(st.nextToken());
    y = Integer.parseInt(st.nextToken());
}

System.out.println(x);
System.out.println(y);

if( x > 0 && y > 0){
    System.out.print(1);
}else if(x < 0 && y > 0){
    System.out.print(2);
}else if( x < 0 && y < 0){
    System.out.print(3);
}else if(x > 0 && y < 0){
    System.out.print(4);
}else{
    System.out.print("잘못 입력 되어있습니다");
}
728x90
반응형

+ Recent posts