王小二切饼
来源:互联网 发布:剑灵邀请一直网络忙 编辑:程序博客网 时间:2024/06/05 16:23
王小二切饼
Time Limit: 1000MS Memory Limit: 65536KB
Submit Statistic
Problem Description
王小二自夸刀工不错,有人放一张大的煎饼在砧板上,问他:“饼不许离开砧板,切n(1<=n<=100)刀最多能分成多少块?”
Input
输入切的刀数n。
Output
输出为切n刀最多切的饼的块数。
Example Input
100
Example Output
5051
代码:切饼问题:#include <stdio.h> #include <stdlib.h>int main(){ int n,i; scanf("%d",&n); long long int h[102]; h[1] = 2; for(i=2;i<=n;i++) h[i] = h[i-1]+i; printf("%lld\n",h[n]); return 0;}老师的思路:把外围的圆也看成一条线,新切的线要与原来的每条线都相交,切几条线增加几块,于是得出公式。暑假里教妹妹数学时有这么一个题,n条线相交,焦点的个数最多有多少个,焦点越多,增加的块数即可得出规律。
阅读全文
0 0
- 王小二切饼
- 王小二切饼
- 王小二切饼
- 王小二切饼
- 王小二切饼
- 王小二切饼
- 王小二切饼
- 王小二切饼
- 王小二切饼
- 王小二切饼
- 王小二切饼
- 王小二切饼
- B-王小二切饼
- SDUT 王小二切饼
- 王小二切饼 (sdut oj)
- 递推D 王小二切饼
- 递归递推之王小二切饼
- 递推递归-B-王小二切饼
- 文章标题
- Logstash插件filter介绍及ELK相关预警配置
- 识别浏览器的方法
- POJ.1321 棋盘问题 (DFS)
- 第五章 神经网络
- 王小二切饼
- pageEncoding和charset 编码 以及<%@ page contentType="text/html; charset=utf-8"....>作用
- attention 机制入门
- 以开始、中间、最后为基准的递归快排实现
- BZOJ 2442 [Usaco2011 Open]修剪草坪 DP+单调队列优化
- UVA 10815 (字符串处理)
- mysql删除大表更快的drop table办法
- Linux软件安装
- 网络编程和反射--简单讲解