A community at LTH dedicated to exchanging knowledge, working on open source software together and having fun.
The labs in this course are on the format that you should write a program that solves an algorithmic problem, by reading from standard in and writing a correct answer to standard output.
We assume that you use a terminal with a
bash-like shell. This is the standard shell for most Linux distributions, and macOS. For windows you can download GitBash.
Let’s say you have written some code in a file
Solver.java, that has a main-function, and you have compiled it with
javac Solver.java, creating a file
There exists an input file that is called
example.in, and the correct output is in
example.ans. Then your program will be checked by running
java Solver < example.in > example.out in your terminal.
This means that the content of
example.in is sent to your program Solver on
stdin, and the output is saved in the file
example.out. Then we can check if your program produced the correct output by using the program
diff example.out example.ans will print nothing if the content is the same (your program worked as excepted) and will print the difference between the files if they differ.
There exists a website called Kattis (open.kattis.com), which has a lot of different algorithmic problems, and uses the same execution-model that we do.
The problems on Kattis can be used as exercises for the course.
If you want to know how to read from
stdin and print to
stdout in your preferred programming language you can check out their help page. There is also som links to for example how judging is done explaining what results you can get when you submit your code:
To use Kattis you need an account. You can either log in via Google/Facebook/LinkedIn, or create one.
If you have problems solving some of the exercises you can join our discord and ask for help in a dedicated channel for the course!