Блог пользователя Tyr

Автор Tyr, 11 лет назад, По-английски

Hi !

Can any of java coders provide me a good template for submitting solutions in different online judges ? I always have trouble with StringTokenizer and so on..., maybe you say so forget java ! and code in C++ but I say java is Cool and java coders are different so I want to be different to (despite the fact that language is nothing but a tool and algorithm and problem solving is important as we see in Knuth TAOCP that he uses Assembly !)

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

»
11 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

You can just look at some Java coders' solutions, such as Petr's or mine :)

  • »
    »
    11 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Thank you man, how can you write things like while(cin >> n) with your fast scanner (how can you read until end of file)?

    • »
      »
      »
      11 лет назад, # ^ |
      Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

      If you use StringTokenizer's template try:

      public boolean hasNext() {
      	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      		try {
      			String line = reader.readLine();
      			if (line == null) {
      				return false;
      			}
      			tokenizer = new StringTokenizer(line);
      		} catch (IOException e) {
      			throw new RuntimeException(e);
      		}
      	}	
      	return true;
      }
      
    • »
      »
      »
      11 лет назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      I do it such way:

      String s = in.readLine();
      while(s != null)
      {
      // Do smth with s here(trim, split, parse, etc.)
      s = in.readLine();
      }
      
»
10 лет назад, # |
  Проголосовать: нравится -25 Проголосовать: не нравится

Great Information admin thanks For Your Information and Any body wants learn Core JAVA through Online for Details Please go through the Link Online Core JAVA Training with free Demo class in USA | UK | INDIA | SINGAPORE This Will Helps you allot.

»
10 лет назад, # |
  Проголосовать: нравится -27 Проголосовать: не нравится

Great Information admin thanks For Your Information and Any body wants learn Core java through Online for Details Please go through the Link Online Core java Training with free Demo class in USA | UK | INDIA | SINGAPORE This Will Helps you allot.

»
10 лет назад, # |
  Проголосовать: нравится -28 Проголосовать: не нравится

We are announcing greatly that we are presenting Teksonit Online Institute all over the world for all courses.So Our teaching techniques are very unique when compare to the other.Great Information admin thanks For Your Information and Any body wants learn Core Java through Online for Details Please go through the Link Online Core Java Training with free Demo class in USA | UK | INDIA | SINGAPORE This Will Helps you allot.