王小二切饼

来源:互联网 发布:华南理工大学软件学院 编辑:程序博客网 时间:2024/06/05 02:51

王小二切饼

Time Limit: 1000MS Memory Limit: 65536KB
Submit Statistic

Problem Description

王小二自夸刀工不错,有人放一张大的煎饼在砧板上,问他:“饼不许离开砧板,切n(1<=n<=100)刀最多能分成多少块?”

Input

输入切的刀数n。

Output

输出为切n刀最多切的饼的块数。

Example Input

100

Example Output

5051

Hint

 

Author

///王小二切饼
/*
#include<iostream>
using namespace std;//编译命令
int main()//主函数开始
{
    int n,cake[1000];//定义变量
    cin>>n;
    cake[0]=1;
    for(int i=1; i<=n; i++)//打表求出前100刀切成的块数
    {
        cake[i]=cake[i-1]+i;
    }
    cout<<cake[n]<<endl;//输出提示信息
    return 0;//主函数结束
}
*/

1 0
原创粉丝点击