#K68402. Counting Ways to Fill a Board with Three Tiles
Counting Ways to Fill a Board with Three Tiles
Counting Ways to Fill a Board with Three Tiles
You are given a board with n positions. In each position, you can place one of three different tiles: A, B, or C. The task is to count the number of ways to fill the board. The answer is given by the formula \(3^n\) for any board with \(n \ge 1\). If \(n\) is less than 1, you should output 0. Note that despite the original problem statement mentioning leaving the last two positions empty, the effective calculation for filling the board is simply based on using three choices per position.
Constraints: Traditionally, \(1 \le n \le 20\), but an edge case with \(n=0\) is also considered where the answer should be 0.
inputFormat
The input consists of a single integer \(n\) on its own line, representing the number of positions in the board.
outputFormat
Output a single integer, which is the number of ways to fill the board. This number is \(3^n\) if \(n \ge 1\), otherwise output 0.
## sample1
3
</p>