hanshin23   6년 전

import java.io.*;
import java.util.*;

public class Main {

public static void main(String args[]) throws IOException {

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

int total = Integer.parseInt(br.readLine());
int standard = Integer.parseInt(br.readLine());
String line = br.readLine();

StringTokenizer str = new StringTokenizer(line, " ");

for(int i = 0; i < total; i++) {
String sm = str.nextToken();
int small = Integer.parseInt(sm);
if( small < standard) {
System.out.print(small + " ");
}

}

}

}


이클립스 상에서는 잘 돌아가는데 왜 백준 온라인 상에서는 런타임에러가 뜰까요?? 토큰 때문인가ㅜㅜ??

hanshin23   6년 전

import java.io.*;
import java.util.*;

public class smaller10871 {

public static void main(String args[]) throws IOException {

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

String number = br.readLine();

StringTokenizer str = new StringTokenizer(number, " ");

int total = Integer.valueOf(str.nextToken());
int standard = Integer.valueOf(str.nextToken());


String line = br.readLine();

StringTokenizer strr = new StringTokenizer(line, " ");

for(int i = 0; i < total; i++) {
int small = Integer.valueOf(strr.nextToken());
if( small < standard) {
System.out.print(small + " ");
}

}


}

}




이렇게 바꾸니까 해결됬음요 ....

댓글을 작성하려면 로그인해야 합니다.