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 43 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的更多相关文章

  1. Java基础之在窗口中绘图——绘制直线和矩形(Sketcher 2 drawing lines and rectangles)

    控制台程序. import javax.swing.JComponent; import java.util.*; import java.awt.*; import java.awt.geom.*; ...

  2. 快速切题sgu127. Telephone directory

    127. Telephone directory time limit per test: 0.25 sec. memory limit per test: 4096 KB CIA has decid ...

  3. 快速切题 sgu120. Archipelago 计算几何

    120. Archipelago time limit per test: 0.25 sec. memory limit per test: 4096 KB Archipelago Ber-Islan ...

  4. 快速切题 sgu117. Counting 分解质因数

    117. Counting time limit per test: 0.25 sec. memory limit per test: 4096 KB Find amount of numbers f ...

  5. 快速切题 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 ...

  6. 快速切题 sgu103. Traffic Lights 最短路 难度:1

    103. Traffic Lights Time limit per test: 0.25 second(s)Memory limit: 4096 kilobytes input: standardo ...

  7. 快速切题 poj3414 Pots

    Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10042   Accepted: 4221   Special J ...

  8. 快速切题 poj2488 A Knight's Journey

    A Knight's Journey Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 31195   Accepted: 10 ...

  9. 快速切题 acdream手速赛(6)A-C

    Sudoku Checker Time Limit: 2000/1000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) Submi ...

随机推荐

  1. sqlserver如何读写操作windows系统的文件

    DECLARE   @object   int     DECLARE   @hr   int     DECLARE   @src   varchar(255),   @desc   varchar ...

  2. html锚点的作用和js选项卡锚点跳转的使用

    location是javascript里边管理地址栏的内置对象,比如location.href就管理页面的url,用location.href=url就可以直接将页面重定向url.而location. ...

  3. The Accomodation of Students---hdu2444(二分图,最大匹配)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2444 题意:有n个学生,m个关系,但是如果a认识b,b认识c,但是a不一定认识c: 求能不能把这n个人 ...

  4. drawable转mitmap 以及图片base64编码

    static Bitmap drawableToBitmap(Drawable drawable) // drawable 转换成bitmap { int width = drawable.getIn ...

  5. MegaCli 监控raid状态

    MegaCli 监控raid状态 http://blog.chinaunix.net/uid-25135004-id-3139293.html 简介 MegaCli是一款管理维护硬件RAID软件,可以 ...

  6. in 和 or 的效率问题

    select * from table where col in (2,3,4,5,6) select * from table where col=2 or col=3 or col=4 or co ...

  7. 3.11 Templates --Rendering with Helpers

    Ember提供几个辅助器允许你使用不同的方法渲染模板(render templates). 一.The {{partial}} Helper {{partial}}以呈现的模板作为参数,并在这里呈现模 ...

  8. Flex远程调用机制RemoteObject应用技巧

    转自:http://zerozone.javaeye.com/blog/60846Flex远程调用RemoteObject出现的问题及解答: 本文主要讨论Flex在客户端与J2EE中间层数据交互的过程 ...

  9. HDU4642

    #include<stdio.h> #include<string.h> int main() { int i,j,n,m; int t; scanf("%d&quo ...

  10. c++第二十四天

    p126~p128: 1.关系运算符作用于算数类型和指针类型. 2.逻辑运算符作用于任意能转换成布尔类型值的类型. 3.以上两种运算的运算对象和运算结果都是右值. 4.逻辑与和逻辑或的运算策略:短路求 ...