[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 ...
随机推荐
- Linux小知识:CentOS使用Google-BBR加速网络
准备一台centos的服务器查看系统内核:rpm -qa | grep kernel这里需要Linux内核在4.9 RC版本以上,如果版本不是请继续下面操作 访问https://elrepo.org/ ...
- dapi 基于Django的轻量级测试平台六 怎样使用压测功能
QQ群: GitHub:https://github.com/yjlch1016/dapi JMeter非GUI模式下: jmeter -n -t jmx脚本 -l jtl文件 -e -o 测试报告目 ...
- WeUI教程/第三方扩展及其他UI框架对比
WeUI 是一套同微信原生视觉体验一致的基础样式库,由微信官方设计团队为微信内网页和微信小程序量身设计,令用户的使用感知更加统一.包含button.cell.dialog. progress. toa ...
- FastDFS 分布式文件系统(部署和运维)
版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/KamRoseLee/article/det ...
- Django学习(不定期更新)
基于luffy项目的疑问点解决 删除掉.git文件夹,应该是该项目不需要git 在git克隆代码之后,初始化git,自动创建git仓库需要的目录,这些文件夹存在于项目下的.git文件夹中 .git文件 ...
- Hibernate框架学习1
框架是什么 1.框架是用来提高开发效率的 2.封装了好了一些功能.我们需要使用这些功能时,调用即可.不需要再手动实现. 3.所以框架可以理解成是一个半成品的项目.只要懂得如何驾驭这些功能即可. orm ...
- Vue Echarts 饼图设置默认选中一个
Vue Echarts 饼图设置默认选中一个 myChart.setOption(data) // data伟echarts所需要传入的参数,就是配置参数最多的那个玩意 myChart.dispatc ...
- 推荐:Markdown编辑软件 --- 小书匠
推荐:Markdown编辑软件 --- 小书匠 小书匠 使用手册 Markdown编辑工具推荐小书匠工具,功能丰富,简单使用,可以一步导文件至博客园主页. 概要 小书匠编辑器是一款专为markdown ...
- 获取DOM元素的方式有哪些
document.getElementById();//id名 document.getElementsByTagName();//标签名 document.getElementsByClassNam ...
- 这样配置:让你的 IDEA 好用到飞起来
阅读本文大概需要 7 分钟. 来源:blog.csdn.net/fly910905/article/details/77868300 1.设置maven 1.在File->settings-&g ...