ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

How java deal with these input?
Posted by bidakung 27 Jan 2011 10:54
When i using BufferedReader of java with readLine function.
It will read for 'N' lines that 'N' is specific.

And when input is not specific of line, how should i deal with the input? How java knows the input string is ended?

Sorry for bad english,

bidakung
Re: How java deal with these input?
Posted by tagetes 23 Apr 2011 15:29
my idea:

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      ..........
      try{
        while(true){
          .....in.readLine().......
        }
      }
      catch(Exception e){}
    ...........


the end of read by Exception.

Edited by author 23.04.2011 17:40
Re: How java deal with these input?
Posted by Maximus 1 Aug 2011 13:52
you can not catch exceptions - this is a bug
Re: How java deal with these input?
Posted by pausuk 24 Sep 2011 18:15
You can use StringTokenizer by reading the line as string and then dividing it into tokens.
Re: How java deal with these input?
Posted by Fatemeh 29 Oct 2011 02:08
        Scanner inputReader = new Scanner(System.in);


        while(inputReader.hasNext()) {
            long n = inputReader.nextLong();

        }



Edited by author 29.10.2011 02:14

Edited by author 29.10.2011 02:19