快速切题 sgu135. Drawing Lines
135. Drawing Lines
time limit per test: 0.25 sec.
memory limit per test: 4096 KB
Little Johnny likes to draw a lot. A few days ago he painted lots of straight lines on his sheet of paper. Then he counted in how many zones the sheet of paper was split by these lines. He noticed that this number is not always the same. For instance, if he draws 2 lines, the sheet of paper could be split into 4, 3 or even 2 (if the lines are identical) zones. Since he is a very curious kid, he would like to know which is the maximum number of zones into which he can split the sheet of paper, if he draws N lines. The sheet of paper is to be considered a very large (=infinite) rectangle.
Input
The input file will contain an integer number: N (0<=N<=65535).
Output
You should output one integer: the maximum number of zones into which the sheet of paper can be split if Johnny draws N lines.
Sample Input #1
0
Sample Output #1
1
Sample Input #2
1
Sample Output #2
2
每次都交原来的线数
#include<cstdio>
using namespace std;
int main(){
long long ans,n;
scanf("%I64d",&n);
ans=((n)*(n+1))/2+1;
printf("%I64d\n",ans);
return 0;
}
快速切题 sgu135. Drawing Lines的更多相关文章
- Java基础之在窗口中绘图——绘制直线和矩形(Sketcher 2 drawing lines and rectangles)
控制台程序. import javax.swing.JComponent; import java.util.*; import java.awt.*; import java.awt.geom.*; ...
- 快速切题sgu127. Telephone directory
127. Telephone directory time limit per test: 0.25 sec. memory limit per test: 4096 KB CIA has decid ...
- 快速切题 sgu120. Archipelago 计算几何
120. Archipelago time limit per test: 0.25 sec. memory limit per test: 4096 KB Archipelago Ber-Islan ...
- 快速切题 sgu117. Counting 分解质因数
117. Counting time limit per test: 0.25 sec. memory limit per test: 4096 KB Find amount of numbers f ...
- 快速切题 sgu104. Little shop of flowers DP 难度:0
104. Little shop of flowers time limit per test: 0.25 sec. memory limit per test: 4096 KB PROBLEM Yo ...
- 快速切题 sgu103. Traffic Lights 最短路 难度:1
103. Traffic Lights Time limit per test: 0.25 second(s)Memory limit: 4096 kilobytes input: standardo ...
- 快速切题 poj3414 Pots
Pots Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10042 Accepted: 4221 Special J ...
- 快速切题 poj2488 A Knight's Journey
A Knight's Journey Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 31195 Accepted: 10 ...
- 快速切题 acdream手速赛(6)A-C
Sudoku Checker Time Limit: 2000/1000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) Submi ...
随机推荐
- C++ new 长度为0的数组
在C++中可以new一个长度为0的数组,通过下面的语句: char* p = new char[0]; 指针p中保存一个非NULL的地址,但是你不能够对p指向的内存进行写入,因为p的内存长度为0, 该 ...
- Struts2的ActionContext
web资源:HttpServletRequest,HttpSession,ServletContext等原生Servlet API Action中如何访问web资源: 1.和Servlet API解耦 ...
- spark 调优概述
分为几个部分: 开发调优.资源调优.数据倾斜调优.shuffle调优 开发调优: 主要包括这几个方面 RDD lineage设计.算子的合理使用.特殊操作的优化等 避免创建重复的RDD,尽可能复用同一 ...
- 浏览器输入url的全过程
########################################################################### ######################## ...
- 模块的封装之C语言类的封装
[微知识]模块的封装(一):C语言类的封装 是的,你没有看错,我们要讨论的是C语言而不是C++语言中类的封装.在展开知识点之前,我首先要 重申两点: 1.面向对象是一种思想,基本与所用的语言是无关的. ...
- HBase Shell相关
1.进入hbase命令行 ./hbase shell 2.基本命令 显示hbase中的表List list 查询user表中的所有信息Scan scan 'users' 清空user表中的数据Trun ...
- HBuilder 获取通讯录
代码: var content=""; function getCallLog() { try{ plus.contacts.getAddressBook(plus.contact ...
- git squash 和 git rebase
In git, what is the difference between merge --squash and rebase? 上面链接的回答中的总结: Both git merge --squa ...
- 【同步时间】Linux设置时间同步
所有节点都要确保已安装ntpd(在步骤4已安装) 1.首先选择一台服务器作为时间服务器. 假设选定为node1.sunny.cn服务器为时间服务器. 2.ntp服务器的配置 修改ntp.conf文件: ...
- [SpringBoot] - 了解什么是SpringBoot,使用SpringBoot的配置文件
首先明白Spring是什么,Spring是Java开发的一个框架,为了方便简化Java开发. 什么是注解(注解式开发)? Spring的常用注解有哪些? 假如用SpringBoot构建一个网站程序,应 ...