Please read the new rule regarding the restriction on the use of AI tools. ×

magma1983's blog

By magma1983, 8 years ago, In English

I solved the same problem in two different programming languages: Java and Python. The Java program is usually longer in terms of LOCs, it uses more memory and his time execution is slower than Python code. As we can see in the next screenshot:

Python seems to be a better choice, however, Java is still widely used.

  • Vote: I like it
  • -38
  • Vote: I do not like it

| Write comment?
»
8 years ago, # |
Rev. 5   Vote: I like it +12 Vote: I do not like it

You are using Scanner to read input in Java. That's why it is very slow, and it's why almost no one uses it in Programming Competitions. Similar things like using strings, and not knowing the complexity of "+" operator can make Java programs very slow.

No Python is not a better option for Competitive Programming in terms of speed. It's very well known, I can get you many problems where getting AC with python is impossible ( due to speed).

Maybe there exists a certain application where Python is faster, but generally no.