atcoder#ABC203E. [ABC203E] White Pawn
[ABC203E] White Pawn
Score : points
Problem Statement
Let be a positive integer. We have a grid where rows are numbered through and columns are also numbered through . Let denote the square at Row and Column .
We have one white pawn, which is initially at . Also, we have black pawns, the -th of which is at .
When the white pawn is at , you can do one of the following operations to move it:
- If , hold and does not contain a black pawn, move the white pawn to .
- If , hold and does contain a black pawn, move the white pawn to .
- If , hold and does contain a black pawn, move the white pawn to .
You cannot move the black pawns.
Find the number of integers such that it is possible to have the white pawn at by repeating these operations.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
2 4
1 1
1 2
2 0
4 2
3
We can move the white pawn to , , and , as follows:
On the other hand, we cannot move it to or . Thus, we should print .
1 1
1 1
0
We cannot move the white pawn from .