|
|
вернуться в форумПоказать все сообщения Спрятать все сообщенияimport java.io.*; import java.util.*; public class A_B_Problem { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int A = Integer.parseInt(reader.readLine()), B = Integer.parseInt(reader.readLine()); out.println(A + B); out.flush(); } } BufferedReader faster, and consumes less memory, what is the problem? See the input format carefully Andrew Sboev "Numbers are located at the same line. So, first call of readLine() give you "a b", and second - null." Потому что по условию задачи входные данные должны быть вида - "5 _ 1", а, если пользуешься ReadLine - то у тебя будет так, 5 1 а ввод вида "5 1" возможен при помощи сканнера Edited by author 28.10.2015 13:28 |
|
|