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.The Workbench is a fast scratchpad for contest coding in Java or JavaScript (pick the language when you press + New). Your program runs on the Input box as you type, so the Result is always up to date. There is no compile step to wait for.
1. Click the Input box and paste the problem's sample input. 2. Switch to Expected output and paste the sample output. 3. Write your code; the Result shows your output next to the expected output, line by line, with differences in red. 4. When it turns green, press Export to save the .java file.
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 templates are grouped the same way. Put your cursor where the code should go, open Templates (or press Ctrl+K), pick one to see exactly what it adds, then press Insert or Enter. Templates marked method go inside the class but outside main and solve.
Each tab at the top is a separate program with its own input and expected output, saved in this browser automatically. Click the file name above the code to rename the class. A tab's dot turns green when the output matches and red on an error. Export checks the file and saves ClassName.java, ready to submit, and can also save every tab as one .zip.
| Ctrl+K | Open templates |
| Ctrl+Enter | Run now |
| 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.
JavaScript files run Node-style: read all of the input with require('fs').readFileSync(0, 'utf8') and print with console.log. The JavaScript starter templates already do this. It runs in your browser, not in a full Node install, so only fs is available to require.
Choose Web page when you press + New file to write HTML, CSS and JavaScript in one file. The right side becomes a live Preview of the page with its Console (where console.log and errors appear). Export saves an .html file that opens in any browser.
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.This is one good way to solve it; yours can be different and still be right. Read it line by line, then close it and write your own version without looking.