CF1180A.Alex and a Rhombus

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

While playing with geometric figures Alex has accidentally invented a concept of a nn-th order rhombus in a cell grid.

A 11-st order rhombus is just a square 1×11 \times 1 (i.e just a cell).

A nn-th order rhombus for all n≥2n \geq 2 one obtains from a n−1n-1-th order rhombus adding all cells which have a common side with it to it (look at the picture to understand it better).

Alex asks you to compute the number of cells in a nn-th order rhombus.

亚历克斯在摆弄几何图形时,偶然在方格纸上发明了一种“nn阶菱形”的概念。

一个 11 阶菱形就是一个 1×11 \times 1 的正方形(即仅一个方格)。

对任意 n≥2n \geq 2,nn 阶菱形由 (n−1)(n-1) 阶菱形通过添加所有与它有公共边的方格而得到(参见下图以更直观地理解)。

亚历克斯请你计算一个 nn 阶菱形所包含的方格数量。

输入格式

The first and only input line contains integer nn (1≤n≤1001 \leq n \leq 100) — order of a rhombus whose numbers of cells should be computed.

第一行且唯一的一行输入包含一个整数 nn(1≤n≤1001 \leq n \leq 100)——表示需要计算其格子数量的菱形的阶数。

输出格式

Print exactly one integer — the number of cells in a nn-th order rhombus.

输出一个整数——第 nn 阶菱形中的格子数量。

输入输出样例

  • 输入#1

    1

    输出#1

    1
  • 输入#2

    2

    输出#2

    5
  • 输入#3

    3

    输出#3

    13

说明/提示

Images of rhombus corresponding to the examples are given in the statement.

示例对应的菱形图像在题目描述中给出。

输入解题思路,AI测评打分。不知道怎么写?

首页