#P1479. 宿舍里的故事之五子棋

宿舍里的故事之五子棋

Description

There are lots and lots of fun things in the dormitory!

Today 7890653 saw Gomoku, which had unknowingly become popular. In the dorm, they took a notebook, drew some squares, and a board was ready.

When 7890653 looked at the board, an idea came to mind...

On a 5×55 \times 5 board, place nn stones, where 5n255 \le n \le 25; the nn stones can be placed anywhere on the board, but they cannot overlap. Thus, there may be five stones forming a row, a column, or lying on the same diagonal. Different placements may produce different numbers of five-in-a-row lines.

Your task: given nn, find all possible counts kk of five-in-a-row lines that can appear over different placements (counting full lines among the 5 rows, 5 columns, and 2 diagonals). For example, when n=11n = 11, we have:

Only these two nonnegative kk values occur (note that kk values are not repeated). You should output the sum of these distinct kk values.

That is, 1+2=31 + 2 = 3.

Input Format

The input contains one line with a single integer nn, as described. Guaranteed 1n251 \le n \le 25.

Output Format

Output the sum of all possible kk values. It is easy to see that k12k \le 12.

11
3

Hint

Translated by ChatGPT 5