Fastest method to generate big random string with lower Latin letters

后端 未结 8 1898
难免孤独
难免孤独 2020-12-06 05:38

I\'m trying to solve this problem from Timus Online Judge. To solve this problem you need generate a sequence of 1 000 000 lowercase Latin letters and write it to stdin in

8条回答
  •  情话喂你
    2020-12-06 06:05

    Try turning some part of it into C++ or another compiled language. That will almost guaranteed make it faster. Python, unfortunately, isn't too fast, especially when it comes to things like this. Try C++, C, or Pascal.

    EDIT: Also see the Python Performance Tips

提交回复
热议问题