折线分割平面
来源:互联网 发布:离婚证制作软件 编辑:程序博客网 时间:2024/05/17 04:31
折线分割平面
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 30188 Accepted Submission(s): 20409
Problem Description
我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。
Input
输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0<n<=10000),表示折线的数量。
Output
对于每个测试实例,请输出平面的最大分割数,每个实例的输出占一行。
Sample Input
212
Sample Output
27
#include <cstdio> #include <string> #include <queue> #include <cmath> #include <stack> #include <vector> #include <algorithm>#include <map> using namespace std; #define INF 0x3f3f3f3f #define CLR(a,b) memset(a,b,sizeof(a)) #define PI acos(-1.0) #define LL long longint main(void){//freopen("题.txt", "r", stdin);int t;int n, i, j;long long f[10001];scanf("%d", &t);f[1] = 2;for(i = 2; i <= 10000; i++){f[i] = f[i-1] + 4*(i-1) + 1;}while(t--){scanf("%d", &n); printf("%lld\n", f[n]);}return 0;}
0 0
- 2050 折线分割平面
- HDU2050折线分割平面
- 折线分割平面问题
- 折线分割平面
- HDOJ2050 折线分割平面
- hdu2050 折线分割平面
- 折线分割平面
- 折线分割平面
- 1023折线分割平面
- 折线分割平面
- 折线分割平面
- HDU2050 折线分割平面
- 折线分割平面 2050
- hdoj2050 折线分割平面
- 2050 折线分割平面
- 折线分割平面
- 折线分割平面
- hdoj2050 折线分割平面
- random用法
- 数据挖掘比赛入门_以去年阿里天猫推荐比赛为例
- ffmpeg实战教程(四)格式转换如MP4转MKV等
- 微信小程序开发—(十一)navigator
- Spring 根据参数名称注入值
- 折线分割平面
- tornado模板参数传递
- java san jiaoxing
- 生产管理系统产品管理的添加方法
- U3D-- U3d Shader的一些知识
- DialogActivity
- 应用最广的模式-单例模式
- SVD与SVD++
- 【深入浅出事务】(1):事务的本质