Press Run to compile and run your program with the sample input, or Submit to check it against every test.Press Run to compile and run your program with the sample input, or Submit to check it against every test.One possible solution. Try it yourself first — then compare approaches!
The Workbench is a fast Java scratchpad for contest coding. As you type, your program runs on whatever is in the Input box, so the Console shows the output while you work. There's no compile step to wait for. If you paste the sample output into Expected output, every line is checked and the console turns green when everything matches.
These windows work the same way as in Code Quest Practice. Drag a title bar onto another window to swap the two, drag the grips between windows to resize them, and click – to minimize. Layout switches between columns, rows, half-and-half and grid arrangements.
New files start from the contest template: main reads the number of test cases and calls solve(t) once for each. Inside solve you do three things: 1. Read that case's lines, 2. Work, 3. Print. The template groups follow the same steps. Put the cursor where you want code and click a snippet, and it goes in on a new line, indented to match. Snippets marked method belong inside the class, after solve. Hover over a snippet to preview it, or press Ctrl+K, type a few letters, and press Enter.
Cheat sheet (top of the Templates window) opens a one-page reference card. It can also be added to the end of your file as a comment.
Each tab at the top is a separate program with its own input and expected output. Everything is saved in this browser automatically. A tab is named after its public class. Its dot turns green when the output matches and red on an error. Export checks the file and saves ClassName.java, ready to submit. It can also save every tab as one .zip.
| Ctrl+Enter | Run now (also works from the Input box) |
| Ctrl+K | Find and insert a template |
| Ctrl+S | Export for submission |
| Ctrl+/ | Comment or uncomment lines |
| Alt+↑ / ↓ | Move lines up or down |
| Ctrl+D | Duplicate the line |
Your code runs in a Java simulator built into this page. It needs no internet connection and no Java install. It covers the Java used in contest problems: Scanner, Strings, arrays, ArrayList, HashMap, TreeMap and other collections, printf, BigInteger, classes and lambdas. It is not a full JDK, though. Before you submit, compile and run your final file once with the real Java compiler.
The Workbench holds no contest problems or solutions, has no AI, and doesn't contact any server. The templates are generic Java patterns, like a printed reference sheet. Every contest sets its own rules about which tools and reference material teams may use, so check with your contest coordinator before you use it in a competition.
public class name, so keep it as it is. Before you submit, compile and run it once with the real Java compiler, since the simulator isn't a full JDK.