Problem Description
王小二自夸刀工不错,有人放一张大的煎饼在砧板上,问他:“饼不许离开砧板,切n(1<=n<=100)刀最多能分成多少块?”
Input
输入切的刀数n。
Output
输出为切n刀最多切的饼的块数。
Example Input
100
Example Output
5051
#include<stdio.h> #include<string.h> #include<stdlib.h> int f(int n) { int fun ; if(n==1) fun = 2; else fun = f(n-1) + n; return fun; } int main() { int m ; scanf("%d",&m); int fun; fun = f(m); printf("%d\n",fun); return 0; }