F. [UOI 2023 II Stage] Pixel snail

    远端评测题 1000ms 512MiB

[UOI 2023 II Stage] Pixel snail

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

题目描述

Pixel snail is such a figure that is very easy to draw on a sheet of graph paper and is very similar to the symbol "@".

Pixel snail of order kk is constructed by the following algorithm:

  • A "frame" is painted - cells along the perimeter of a square with a side of kk.
  • A cell is painted whose upper left corner coincides with the lower right corner of the frame. We will call this cell the "bridge".
  • All cells outside the frame at a distance of one cell from it are painted. At the same time, cells that touch the bridge (with the exception of the cell whose lower left corner coincides with the upper right corner of the bridge: it is still painted) are not painted. The figure below shows pixel snails of the 1st, 2nd, 3rd and 4th orders.

:::align{center} :::

The cells that are painted in the first, second and third steps of the algorithm are marked with numbers (1, 2, 3), respectively.

Write a program that will find the number of cells that need to be painted to draw a pixel snail of the kk-th order.

输入格式

The first line contains a single integer kk (1k1081 \le k \le 10^{8}).

输出格式

Print a single number - the number of cells that need to be painted to draw a pixel snail of the kk-th order.

2
18
3
26

提示

If your program outputs the correct answer for all kk from 11 to 1010, you will receive 4040 points.

0703语法

未参加
状态
已结束
规则
IOI
题目
6
开始于
2026-7-3 14:15
结束于
2026-7-3 16:15
持续时间
2 小时
主持人
参赛人数
34