zoukankan      html  css  js  c++  java
  • 快速切题 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 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
    ",ans);
        return 0;
    }
    

      

  • 相关阅读:
    [BJWC2010]外星联络
    [NOI2015]品酒大会
    工艺 /【模板】最小表示法
    [NOI2016]优秀的拆分
    [HEOI2016/TJOI2016]字符串
    [SDOI2016]生成魔咒
    【模板】后缀自动机 (SAM)【SA解法】
    [湖南集训]图森
    [USACO17DEC]Standing Out from the Herd P
    Annihilate
  • 原文地址:https://www.cnblogs.com/xuesu/p/4028107.html
Copyright © 2011-2022 走看看