Kattis is a website that allows for automatic testing of your solutions to certain problems. This is where you will go to find problems to work on. Click here to access the public Kattis site.
Registration for Kattis
Registration for Kattis is optional. You may still test your solutions to each of the problems using the sample inputs on the repl.it interface. We recommend registering for Kattis if either:
- You want to fully test your solutions using more than just the sample inputs.
- You are a K-12 teacher and want to investigate using Kattis in your classroom.
To register, visit the Kattis registration page
and create an account. You will need to choose a username that is specific to
you and not your email address (as
@ is not allowed in your username).
Submitting Kattis Problems
Visit the problem page and click the green submit button. Upload your solution, and check to make sure it was accepted!
Tips for Kattis Problems
Kattis gives you your input just like a user would, and checks for the answer
in your program's output, which means you can use the regular
print() functions to handle this.
Kattis does not need input prompts, after all, she is a computer program. This
means you can leave the arguments to
input() blank. Putting anything in the
prompt will confuse her. Here's an example:
number = int(input()) print(number)
Handling Multiple Test Cases
Often problems on Kattis will have you run multiple test cases. The simple solution is to put each case in a loop. Here's an example:
Say you are given an input with the first line being N, the number of test cases. Then, N lines follow, and each line has a word to convert from lower to upper case. Here is an example input:
7 all your base are belong to us
Then here is an example solution:
N = int(input()) for case in range(N): # Handle each test case here word = input() print(word.upper())
Handling Multiple Integers Per Line
Often problems on Kattis require you to input multiple integers per line.
There's a few ways to handle this, but in all cases you will have to read the
whole line then use
str.split() to separate the line into individual pieces.
Here is an example on how to read three integers on the same line:
line = input().split() a = int(line) b = int(line) c = int(line) # ... do something