CP-1.001 Java Tutorial - Input/Output

Поділитися
Вставка
  • Опубліковано 28 жов 2024

КОМЕНТАРІ • 6

  • @얼음물-g2f
    @얼음물-g2f 2 роки тому +1

    Personally I prefer BufferedReader and PrintWriter for I/O

    • @DanielSutantyo
      @DanielSutantyo  2 роки тому

      It's actually faster than using Scanner, but I chose Scanner for the target audience so that we don't have to worry about tokenizing the string =). There are definitely questions where using a Scanner can result in a TLE.

    • @얼음물-g2f
      @얼음물-g2f 2 роки тому

      @@DanielSutantyo Yeah exactly, but I guess Scanner is the easiest way for beginners so it makes sense in a tutorial like this There are also more ways for faster output options like buffered writer, but usually I like print writer more. The only difference to system.out is that you have to use bw.flush() afterwards or set auto flush to true. People would not expect it, but sometimes i/o can be the bottleneck so it is worth to consider it. Btw thx for your Java videos, there are basically like 10 people on earth who use Java for cp, so thank you for being one of the other nine haha

    • @얼음물-g2f
      @얼음물-g2f 2 роки тому

      哦btw你是中国人吗-?

    • @DanielSutantyo
      @DanielSutantyo  2 роки тому +2

      @@얼음물-g2f Nope, but I can read enough to understand that lol.
      We use Java because that's what our uni use for 1st and 2nd year students, and yeah, I think 99% of CP is C++ =).

    • @얼음물-g2f
      @얼음물-g2f 2 роки тому

      @@DanielSutantyo Yeah, C++ is more efficient and the std library is great, so it is probably the better option. Sometimes I also wonder why Rust is so uncommon in CP. We learn C/C++, Java, Assembly and Haskell in first year at my university + VHDL.