Description

王小二自夸刀工不错,有人放一张大的圆煎饼在砧板上,问他:饼不允许离开砧板,切100刀最多能切多少块?

Input

多组测试数据,每组输入1个整数,代表切的刀数

Output

每组输出1个整数,为最多能切的块数

Sample Input

1
2
3

Sample Output

2
4
7
#include<stdio.h>
int f(int n)
{
if(n==)
return ;
else
return n+f(n-);
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
printf("%d\n",f(n));
}
return ;
}

刀数 最多切的块数
0 1=1
1 1+1=2
2 1+1+2=4
3 1+1+2+3=7
4 1+1+2+3+4=11
5 1+1+2+3+4+5=16
. .....
n 1+1+2+3+4+5+...+n=1+(1+n)*n/2

Problem G: 切煎饼的更多相关文章

  1. 实验9:Problem G: 克隆人来了!

    想要输出""的话: cout<<"A person whose name is \""<<name<<" ...

  2. 实验12:Problem G: 强悍的矩阵运算来了

    这个题目主要是乘法运算符的重载,卡了我好久,矩阵的乘法用3个嵌套的for循环进行,要分清楚矩阵的乘法结果是第一个矩阵的行,第二个矩阵的列所组成的矩阵. 重载+,*运算符时,可以在参数列表中传两个矩阵引 ...

  3. 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem G: Check The Check(模拟国际象棋)

    Problem G: Check The Check Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 10  Solved: 3[Submit][Statu ...

  4. The Ninth Hunan Collegiate Programming Contest (2013) Problem G

    Problem G Good Teacher I want to be a good teacher, so at least I need to remember all the student n ...

  5. 【贪心+中位数】【新生赛3 1007题】 Problem G (K)

    Problem G Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Sub ...

  6. Problem G: If We Were a Child Again

    Problem G: If We Were a Child AgainTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solved: 14[Submi ...

  7. Problem G: Keywords Search

    Problem G: Keywords SearchTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 10 Solved: 6[Submit][Status] ...

  8. BZOJ4977 八月月赛 Problem G 跳伞求生 set 贪心

    欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - BZOJ4977 - 八月月赛 Problem G 题意 小明组建了一支由n名玩家组成的战队,编号依次为1到n ...

  9. Western Subregional of NEERC, Minsk, Wednesday, November 4, 2015 Problem G. k-palindrome dp

    Problem G. k-palindrome 题目连接: http://opentrains.snarknews.info/~ejudge/team.cgi?SID=c75360ed7f2c7022 ...

随机推荐

  1. Problem D. Berland Railroads Gym - 101967D (思维)

    题目链接:https://cn.vjudge.net/contest/274029#problem/D 题目大意:给你0-9每个数的个数,然后让你找出最大的数,满足的条件是任意三位相连的都能被三整除. ...

  2. docker 升级后,配置 idea 连接 docker

    [root@A01-R02-I188-87 ~]# docker version Client: Version: 18.06.1-ce API version: 1.24 Go version: g ...

  3. (4)剑指Offer之链表相关编程题

    一 链表中倒数第k个节点 题目描述: 输入一个链表,输出该链表中倒数第k个结点 问题分析: 一句话概括: 两个指针一个指针p1先开始跑,指针p1跑到k-1个节点后,另一个节点p2开始跑,当p1跑到最后 ...

  4. 如何在Linux启动的时候执行一个命令

    在Linux启动起来时,执行一个命令的设置方法== 例如:需要执行的命令是cvslockd ============第一种方式:根据运行级别配置======================== 第一步 ...

  5. 设置NGINX进程分配至多核CPU提升性能

    Nginx 配置文件 nginx.conf 首先需要找到 Nginx 的配置文件 nginx.conf 才能进行下面的操作,在LNMP一键安装包默认配置下,nginx.conf 存放在/usr/loc ...

  6. html清屏 meta http-equiv="refresh" content="3">

    <meta http-equiv="refresh" content="3"> 什么意思? <meta http-equiv="re ...

  7. CEPH 使用SSD日志盘+SATA数据盘, 随OSD数目递增对性能影响的递增测试

    最近建设新机房,趁项目时间空余较多,正好系统的测试一下CEPH集群性能随OSD数目的变化情况, 新ceph集群测试结果如下: 1)4k随机读在3/6/9osd host下的性能差不多,吞吐量约50~6 ...

  8. 图像显著性论文(一)—A Model of saliency Based Visual Attention for Rapid Scene Analysis

    这篇文章是图像显著性领域最具代表性的文章,是在1998年Itti等人提出来的,到目前为止引用的次数超过了5000,是多么可怕的数字,在它的基础上发展起来的有关图像显著性论文更是数不胜数,论文的提出主要 ...

  9. First Missing Positive——数学类

    转:http://blog.csdn.net/nanjunxiao/article/details/12973173 Given an unsorted integer array, find the ...

  10. 快速地从Redhat系转Ubuntu系

    ubuntu官网的,https://help.ubuntu.com/community/SwitchingToUbuntu/FromLinux/RedHatEnterpriseLinuxAndFedo ...