CF630D.Hexagons!
普及-
通过率:0%
时间限制:0.50s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
After a probationary period in the game development company of IT City Petya was included in a group of the programmers that develops a new turn-based strategy game resembling the well known "Heroes of Might & Magic". A part of the game is turn-based fights of big squadrons of enemies on infinite fields where every cell is in form of a hexagon.
Some of magic effects are able to affect several field cells at once, cells that are situated not farther than n cells away from the cell in which the effect was applied. The distance between cells is the minimum number of cell border crosses on a path from one cell to another.
It is easy to see that the number of cells affected by a magic effect grows rapidly when n increases, so it can adversely affect the game performance. That's why Petya decided to write a program that can, given n, determine the number of cells that should be repainted after effect application, so that game designers can balance scale of the effects and the game performance. Help him to do it. Find the number of hexagons situated not farther than n cells away from a given cell.

在IT City的一家游戏开发公司经过试用期后,佩佳(Petya)被编入一个程序员小组,负责开发一款新型回合制策略游戏,该游戏与广为人知的《魔法门之英雄无敌》(Heroes of Might & Magic)颇为相似。游戏的一部分内容是,在无限大的六边形网格战场上,进行大规模敌方部队之间的回合制战斗。
某些魔法效果能够同时影响多个格子,即影响以施放位置为中心、距离不超过 $ n $ 个格子的所有格子。“格子间的距离”定义为:从一个格子到另一个格子所需穿越的格子边界的最少次数。
显然,当 $ n $ 增大时,受魔法效果影响的格子数量将迅速增长,从而可能对游戏性能产生不利影响。因此,佩佳决定编写一个程序:对于给定的 $ n $,计算出需要重绘的格子总数,以便游戏设计师能据此权衡魔法效果的作用范围与游戏性能。请你帮助他完成这项任务:求出距离给定中心格子不超过 $ n $ 个格子的所有六边形格子的总数。

输入格式
The only line of the input contains one integer n (0 ≤ n ≤ 109).
输入仅包含一行,其中有一个整数 n(0 ≤ n ≤ 109)。
输出格式
Output one integer — the number of hexagons situated not farther than n cells away from a given cell.
输出一个整数——距离给定单元格不超过 n 个单元格的六边形数量。
输入输出样例
输入#1
2
输出#1
19
输入解题思路,AI测评打分。不知道怎么写?