[Codeforces] Alex and a Rhombus
1 second
256 megabytes
standard input
standard output
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×1 (i.e just a cell).
A nn-th order rhombus for all n≥2n≥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.
The first and only input line contains integer nn (1≤n≤1001≤n≤100) — order of a rhombus whose numbers of cells should be computed.
Print exactly one integer — the number of cells in a nn-th order rhombus.
1
1
2
5
3
13
Images of rhombus corresponding to the examples are given in the statement.
算格子數
就是等差數列 1 + 3 + 5 + ....
最後一塊 last = n * 2 -1; 這個會重複

class Program
{
static void Main(string[] args)
{
Console.WriteLine(Solution.Compute(Convert.ToInt32(Console.ReadLine())));
}
} class Solution
{
public static int Compute(int n)
{
int last = n * - ;
return ( + last) * n - last;
}
}
[Codeforces] Alex and a Rhombus的更多相关文章
- Codeforces Round #569 (Div. 2)A. Alex and a Rhombus
A. Alex and a Rhombus 题目链接:http://codeforces.com/contest/1180/problem/A 题目: While playing with geome ...
- Codeforces Round #569 (Div. 2) 题解A - Alex and a Rhombus+B - Nick and Array+C - Valeriy and Dequ+D - Tolik and His Uncle
A. Alex and a Rhombus time limit per test1 second memory limit per test256 megabytes inputstandard i ...
- Codeforces Round #542 [Alex Lopashev Thanks-Round] (Div. 2) 题解
Codeforces Round #542 [Alex Lopashev Thanks-Round] (Div. 2) 题目链接:https://codeforces.com/contest/1130 ...
- Codeforces Round #586 (Div. 1 + Div. 2) D. Alex and Julian
链接: https://codeforces.com/contest/1220/problem/D 题意: Boy Dima gave Julian a birthday present - set ...
- 【Codeforces 1097F】Alex and a TV Show(bitset & 莫比乌斯反演)
Description 你需要维护 \(n\) 个可重集,并执行 \(m\) 次操作: 1 x v:\(X\leftarrow \{v\}\): 2 x y z:\(X\leftarrow Y \cu ...
- Codeforces Round #542 [Alex Lopashev Thanks-Round] (Div. 1) C(二分+KMP)
http://codeforces.com/contest/1129/problem/C #include<bits/stdc++.h> #define fi first #define ...
- Codeforces Round #542 [Alex Lopashev Thanks-Round] (Div. 2) A - D2
A. Be Positive 链接:http://codeforces.com/contest/1130/problem/A 题意: 给一段序列,这段序列每个数都除一个d(−1e3≤d≤1e3)除完后 ...
- 【Codeforces Round 1129】Alex Lopashev Thanks-Round (Div. 1)
Codeforces Round 1129 这场模拟比赛做了\(A1\).\(A2\).\(B\).\(C\),\(Div.1\)排名40. \(A\)题是道贪心,可以考虑每一个站点是分开来的,把目的 ...
- CodeForces - 1097F:Alex and a TV Show (bitset & 莫比乌斯容斥)
Alex decided to try his luck in TV shows. He once went to the quiz named "What's That Word?!&qu ...
随机推荐
- CentOS6.7编译安装mysql5.6
可能因为有各种情况,无法通过yum安装mysql,这里记录一下编译安装的简单步骤 使用yum安装一些依赖 yum -y install make gcc-c++ cmake bison-devel ...
- ansible自动化运维04
ansible playbook ansible-playbook命令格式: ansible-playbook [option] filename(剧本名字) ansible-playbook 命 ...
- JfreeChart 乱码问题处理
在前面之间加上下面这段代码即可. //创建主题样式 StandardChartTheme standardChartTheme=new StandardChartTheme("CN" ...
- POJ 2516Minimum Cost(最小费用流+特判)
[题意]: 有N个人,M个仓库,每个人需要物品,个数都等于共同的K,仓库中有对应的K件物品的数量,随后给K个N*M矩阵(小写k, n, m表示K,N,M对应的子集),表明m个仓库到第n个人的位置运送k ...
- pycharm与github的使用
1.clone代码: 输入github的存储库地址,输入本地存储目录,点击clone即可: 2.上传代码: 输入存储库名字,点击share即可:github上就会有你分享的代码啦
- django modelformse批量编辑 查询学生班级成绩
复习先知 关于三张表的编辑学生成绩在跨表查询的对象查询种,只能通过找到两张表的关联的对象,进行跨表,就是在一对多或多对多的模型找到他们俩的class_id或student_id在关联时,会通过他们找到 ...
- SpringBoot开发mockserver及生成swagger接口文档
通过springboot开发mock server,包含get及post接口,用于练习接口自动化及jmeter很方便 当然,也为后面jenkins持续集成做基础(开发push代码后 → jenkin ...
- LOJ#107. 维护全序集(FHQ Treap)
题面 传送门 题解 板子,没啥好说的 //minamoto #include<bits/stdc++.h> #define R register #define inline __inli ...
- GO 解决使用bee工具,报 bash: bee: command not found
我最近使用beego时,遇到以下问题:command not found使用vscode时,运行bee run,报以下错 我查到一篇文章csdn,说用拷贝bee.exe方法,我觉得纯扯淡 如何解决? ...
- ZBX_TCP_READ() time out windows
zabbix 客户端无法推送数据,日志显示在启动的时候ZBX_TCP_READ() time out windows, 场景:agent 到proxy的10051通,proxy到agnet的10050 ...