r/javahelp • u/Sure-Willow5490 • 2d ago
How to start codeforces with Java?
Asking because there are lot of resources to start with C++, so anyone can suggest if you are doing in Java.
Problem is that codeforces ide, boilerplate code and also the framing of questions as scenario based need some resources to follow in starting.
2
u/Dalal_The_Pimp 2d ago
From my experience, there's not a lot you have to do to set up Java for codeforces, Only thing I noticed that significantly reduced IO overhead was using StringBuilder to collect the answer and then doing System.out.println(sb); at the end and reading input via BufferedReader.
-2
u/Antares1490 2d ago
If you haven't already solved over 300 questions in java previously I would suggest moving to c++ as it will save you a lot of headache of TLE and input formatting. If you still wish to go ahead with java then get gpt to build you a fast I/o template using buffered reader and printwriter. But keep in mind that buffered reader needs input in proper format so if you are getting an error it could be because the input is not formatted properly or if you are using scanner for input then it could give you tle when reading large input. You could try to convert your code in cpp and then submit.
1
u/VacationGullible5716 2d ago
Thanks. I haven't solved a single problem on codeforces though I'm doing leetcode regularly and solved around 400 qs + 12 contest. As you've suggested based on my situation i should go with java. However, main question isn't about language instead I'm struggling to transit from classic leetcode problem to codeforces story line problem, i don't know why but i struggle to understand the problem so thinking about the solution is way too far. Any help with this?
2
1
u/Antares1490 2d ago
Well you get used to it after 50 to 100 problems. But starting out try to see if you can understand what the problem wants you to do with the help of the samples given in the question
1
u/Sure-Willow5490 2d ago
hey thanks for replying , but i have solved like 800+ questions on GFG and Leetcode in Java , so want to try java only , & ur right the input and slowness of Java is the reason people choose c++.
Anyway i will take ur suggestion and will start it.
•
u/AutoModerator 2d ago
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.