Problem D
Rasterized Lines
Tomáš is a computer graphics student. He has a homework
which is very easy for him. He is supposed to make a program
that draws a line from point
He uses the following algorithm. He divides the plane into
squares
![\includegraphics[width=0.5\textwidth ]{obrazok.pdf}](/problems/rasterized/file/statement/en/img-0001.png)
Tomáš did his homework in 30 minutes and now he is
interested in a slightly different problem. Given an integer
More precisely, he is only interested in lines beginning in
Input
The first line of the input file contains an integer
Each test case looks as follows. The one and only line
contains a positive integer
Output
For each test case output one line with one integer – the
number of lines that use exactly
Sample Input 1 | Sample Output 1 |
---|---|
2 2 6 |
3 11 |