2 shunfurh shunfurh 于 2017.09.10 18:47 提问

Count the Regions

What's the maximum number of regions definable by N zig-zag lines, each of which consists of two parallel infinite half-lines joined by a straight line segment?

Here is an example of 2 zig-zag lines yield 12 regions at the most.

Input

The input consists of a sequence of N (<= 10000), which is the number of the zig-zag lines, one per line.

Output

For each N, you should output the number of the maximum regions.

Sample Input

1
2

Sample Output

2
12

1个回答

devmiao
devmiao   Ds   Rxr 2017.09.27 21:52
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
UVALive6663 Count the Regions
题目链接:https://icpcarchive.ecs.baylor.edu/external/66/6663.pdf 题目大意:给你很多
ZOJ 1652 Count the Regions
<br />这个题目是<<具体数学>>第一章的一个课后习题,当时我是独立做出来的,今天偶然发现了,就把他AC掉了,因为太简单,就用了最近看的C++.嘿嘿.<br /> <br />#include<iostream> using namespace std; int main() { int n; while(cin>>n) { cout<< (9*n*n-7*n+2)/2 <<endl; } return 0; }
130 Surrounded Regions
题目链接:https://leetcode.com/problems/surrounded-regions/题目:Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surro
no space in execution regions with .any selector matching
可能原因之一,储存空间不够大,可考虑使用flash储存 解决方法: keil5 打开option for target 在linker页面,选择use memory layout from target dialog 在target页面按需要修改IROM1和IRAM1(图中填写数据仅为示范,实际过大)
HBase-Regions in Transition 问题
1. 问题描述 发现hbase集群中有一个表的regionzai
Keil 链接错误 Error: L6406E: No space in execution regions with .ANY selector matching
Keil 链接错误 Error: L6406E: No space in execution regions with .ANY selector matching
(LeetCode 130)Surrounded Regions(并查集)
Q: Given a 2D board containing ‘X’ and ‘O’, capture all regions surrounded by ‘X’.A region is captured by flipping all ‘O’s into ‘X’s in that surrounded region.For example, X X X X X O O X X X O X
RCNN(Regions with Convolutional Neural Network Feature)
背景知识 在目标检测评价中,有一个参数定位准确率,即IOU,IOU计算公式如下: ​ 简单来说,IOU就是模型预测的bounding box与标记bounding box的重合率. 通常我们预测的bounding box是无法与标记bounding box完全重合的,例如下面几种情况: 因此可以通过求两个bounding box的重合率即IOU,并设定一个阈值t0,并认为IOU值
Maximally Stable Extremal Regions (MSER)特征
Maximally Stable Extremal Regions (MSER) is a feature detector; Like the SIFT detector, the MSER algorithm extracts from an image I a number of co-variant regions, called MSERs. An MSER is a stablec
LeetCode 130 Surrounded Regions(并查集)
Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. For example, X X