Experimental Educational Round: VolBIT Formulas Blitz D

Description

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.

Input

The only line of the input contains one integer n (0 ≤ n ≤ 109).

Output

Output one integer — the number of hexagons situated not farther than n cells away from a given cell.

Examples

input

2

output

19数列,问的是周围到0的有多少个
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x7fffffff
#define INF 0x7fffffffffffffff
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
LL  powl(LL x, LL n)
{
    LL pw = 1;
    while (n > 0)
    {
        if (n & 1)        // n & 1 等价于 (n % 2) == 1
            pw *= x;
        x *= x;
        n >>= 1;        // n >>= 1 等价于 n /= 2
    }
    return pw;
}
LL n;
int main()
{
    cin>>n;
    cout<<n*(6+6*n)/2+1<<endl;
    return 0;
}

  

时间: 2025-01-21 17:54:29

Experimental Educational Round: VolBIT Formulas Blitz D的相关文章

Experimental Educational Round: VolBIT Formulas Blitz J

Description IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when

Experimental Educational Round: VolBIT Formulas Blitz C

Description The numbers of all offices in the new building of the Tax Office of IT City will have lucky numbers. Lucky number is a number that consists of digits 7 and 8 only. Find the maximum number of offices in the new building of the Tax Office g

Experimental Educational Round: VolBIT Formulas Blitz F

Description One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate e

Experimental Educational Round: VolBIT Formulas Blitz K

Description IT City company developing computer games decided to upgrade its way to reward its employees. Now it looks the following way. After a new game release users start buying it actively, and the company tracks the number of sales with precisi

【Codeforces Round 1132】Educational Round 61

Codeforces Round 1132 这场比赛做了\(A\).\(B\).\(C\).\(F\)四题,排名\(89\). \(A\)题\(wa\)了一次,少考虑了一种情况 \(D\)题最后做出来,但被\(hack\)了...被\(hack\)的原因是没有想到答案会超过\(10^{12}\)(毕竟这个时间上的优化也是在最后迫不得已的情况下加的,就没有考虑正确性... Codeforces 1132 C 题意:给一些区间\([l_i,r_i]\),从中删掉两个,求剩下的区间最多能够覆盖的格子数

【Codeforces】Educational Round 61

今天刚打完一场,心情异常烂,只做出来一道题,开错题了然后没钻出来,机房的小伙伴都切了四道题了...可能又要掉了,要继续努力了. 这次Edu Round比赛是这周第二次在宿舍请假了,等网安结束了就退宿吧. 比较顺利的做出了ABC,然后看人数去推了F题,不过没什么结果. 然后在改代码的时候结识了白学长,:) 话说这几天好燥啊,G题其实代码挺好理解但愣是拖了两天啊. Problem A. Regular Bracket Sequence 题目大意:现在给出 4 种括号依次为 "((" , &

Codeforces Educational Round 23

A emmmmmmmmm B emmmmmmmmm C(套路) 题意: 给定n和s(n,s<=1e18),计算n以内有多少个数x满足(x-x的各个位置数字之和)>=s 分析: 容易想到如果x相对于s很大很大,那么肯定是满足条件的 那些小于s的数,肯定是不行的 于是x就可以从s开始,往后枚举1e6个,去判定这1e6个有多少个是满足条件的,再往后的那些x肯定是满足的,直接算出多少个就行了 D(插板法) 题意: 给定一个长度为n(n<=1e6)的数列,对于这个数列的一个连续的子列,定义valu

Educational Round 15

A题Maximum Increase 大水题.最长连续递增子序列有多长. 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 int main() 5 { 6 int n, a, rec = 0, len = 0, ans = 1; 7 scanf("%d",&n); 8 for(int i = 0; i < n; i++) 9 { 10 scanf("%

CodeForce Educational round Div2 C - Vasya and Robot

C. Vasya and Robot time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell (0,0)(0,0). Robot can perfor