D -
Hexagons!

Crawling in process...
Crawling failed
Time Limit:500MS    
Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

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.

Sample Input

Input
2
Output
19
1,6,12,18....明显就是1,1*6,2*6,3*6....除了第一项,就是一个等差序列带公式就行了
#include<iostream>
using namespace std;
#define LL long long
int main()
{
LL n;
cin>>n;
cout<<n*(6+6*n)/2+1<<endl;
return 0;
}


Codeforces--630D--Hexagons(规律)的更多相关文章

  1. codeforces 630D Hexagons!

    D. Hexagons! time limit per test 0.5 seconds memory limit per test 64 megabytes input standard input ...

  2. codeforces 615E Hexagons (二分+找规律)

    E. Hexagons time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  3. codeforces 362A找规律

    刚开始以为是搜索白忙活了原来是个简单的找规律,以后要多想啊 此题是两马同时跳 A. Two Semiknights Meet time limit per test 1 second memory l ...

  4. codeforces——思路与规律

    codeforces 804B     http://codeforces.com/problemset/problem/804/B /* 题意:给定一个只含ab的序列,每次操作可将ab变为bba 问 ...

  5. Nastya and a Wardrobe CodeForces - 992C(规律)

    写一下二叉树  推一下公式就出来了, 注意取模时的输出形式 #include <bits/stdc++.h> #define mem(a, b) memset(a, b, sizeof(a ...

  6. Codeforces 145A-Lucky Conversion(规律)

    A. Lucky Conversion time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  7. codeforces D. Queue 找规律+递推

    题目链接: http://codeforces.com/problemset/problem/353/D?mobile=true H. Queue time limit per test 1 seco ...

  8. Codeforces Gym 100015A Another Rock-Paper-Scissors Problem 找规律

    Another Rock-Paper-Scissors Problem 题目连接: http://codeforces.com/gym/100015/attachments Description S ...

  9. Codeforces Round #338 (Div. 2) E. Hexagons 讨论讨论

    E. Hexagons 题目连接: http://codeforces.com/contest/615/problem/E Description Ayrat is looking for the p ...

  10. Codeforces Round #347 (Div. 2) C. International Olympiad 找规律

    题目链接: http://codeforces.com/contest/664/problem/C 题解: 这题最关键的规律在于一位的有1989-1998(9-8),两位的有1999-2098(99- ...

随机推荐

  1. O-理解共享池

    我们可以通过show sga命令查看共享池的整体组成部分: ....待截图.... 一.SGA内存结构 Oracle中SGA主要包括: 1.固定数据结构部分(FIXED Size) 2.数据块缓冲区( ...

  2. 【sqli-labs】 less58 GET -Challenge -Double Query -5 queries allowed -Variation1 (GET型 挑战 双查询 只允许5次查询 变化1)

    单引号闭合成功,但是union select结果不对 http://192.168.136.128/sqli-labs-master/Less-58/?id=0' union select 1,2,3 ...

  3. Memcached 之PHP实现服务器集群一致性hash算法

    /** * memcached 一致性hash,分布式算法 * Class MemcacheCluster */ class MemcacheCluster { protected $nodes = ...

  4. cshtml中字符串中表示特殊字符@

    用“@@”表示字符串中的特殊字符@

  5. modelsim 仿真软件 百度云分享 modelsim se 10.7 10.6d 10.6c 10.5 10.4

    modelsim se 10.7 链接:https://pan.baidu.com/s/1NDC2yMCZmA4bIRSk2dUiTg 提取码:4l1d 复制这段内容后打开百度网盘手机App,操作更方 ...

  6. 16.copy_to定制组合field解决cross-fields搜索弊端

    主要知识点: 在index的mapping中加copy_to字段的方法 copy_to搜索方法     用most_fields策略,去实现cross-fields搜索,有3大弊端,为了解决这三个弊端 ...

  7. python--(socket与粘包解决方案)

    python--(socket与粘包解决方案) 一.socket: Socket 是任何一种计算机网络通讯中最基础的内容.例如当你在浏览器地址栏中输入 http://www.cnblogs.com/ ...

  8. 第七节:numpy之矩阵及特殊矩阵的创建

  9. hdu 3500 DFS(限定)

    Fling Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submi ...

  10. c# SQL事务

    SQL事务执行 SqlTransaction   sqlTransaction   =   sqlConnection.BeginTransaction();    SqlCommand   sqlC ...