fzuoj Problem 2177 ytaaa
http://acm.fzu.edu.cn/problem.php?pid=2177
Accept: 113 Submit: 265
Time Limit: 2000 mSec Memory Limit : 32768 KB
Problem Description
Input
Output
Sample Input
5 9 8 2 1 6
Sample Output
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <iomanip>
#include <vector>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#pragma warning(disable:4786) using namespace std; const int INF = 0x3f3f3f3f;
const int MAX = + ;
const double eps = 1e-;
const double PI = acos(-1.0); int dp[MAX];
int a[MAX]; int main()
{
int n;
while(~scanf("%d",&n))
{
int i , j;
for(i = ;i <= n;i ++)
scanf("%d",&a[i]);
memset(dp , , sizeof(dp));
for(i = ;i <= n;i ++)
for(j = i;j >= ;j --)
dp[i] = max(dp[i] , dp[j - ] + (a[i] - a[j]) * (a[i] - a[j]));
printf("%d\n",dp[n]);
}
return ;
}
fzuoj Problem 2177 ytaaa的更多相关文章
- fzuoj Problem 2129 子序列个数
http://acm.fzu.edu.cn/problem.php?pid=2129 Problem 2129 子序列个数 Accept: 162 Submit: 491Time Limit: ...
- fzuoj Problem 2179 chriswho
http://acm.fzu.edu.cn/problem.php?pid=2179 Problem 2179 chriswho Accept: 57 Submit: 136 Time Limi ...
- fzuoj Problem 2182 水题
http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188 Submit: 277Time Limit: 100 ...
- FZUOJ Problem 2178 礼品配送
Problem 2178 礼物分配 题目链接: Click Here~ Problem Description 在双胞胎兄弟Eric与R.W的生日会上,他们共收到了N个礼物,生日过后他们决定分配这N个 ...
- FZUOJ Problem 2200 cleaning DP
Problem 2200 cleaning Problem Description N个人围成一圈在讨论大扫除的事情,需要选出K个人.但是每个人与他距离为2的人存在矛盾,所以这K个人中任意两个人的距 ...
- ZCMU 2177 Lucky Numbers (easy)
传送门: http://acm.zcmu.edu.cn/JudgeOnline/problem.php?id=2177 2177: Lucky Numbers (easy) 时间限制: 2 Sec ...
- FZU2177——ytaaa——————【区间dp】
ytaaa Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- Problem 2238 Daxia & Wzc's problem 1627 瞬间移动
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1627 http://acm.fzu.edu.cn/problem.php ...
- 【hdu 2177】取(2堆)石子游戏
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s) ...
随机推荐
- 关于优化sql查询的一个方法。
select * from gmvcsbase.base_file file,gmvcsbase.base_user user,gmvcsbase.base_department dep,gmvcsb ...
- 线程池ThreadPoolExecutor
线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int maxi ...
- Apache Camel
Apache Camel 1 import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; i ...
- autowire异常的三个情况
2010-3-11 16:06:00 net.sf.ehcache.config.ConfigurationFactory parseConfiguration 警告: No configuratio ...
- avalon---qunar ued
http://avalonjs.github.io/ http://ued.qunar.com/ https://github.com/RubyLouvre/avalon 1.前后端分离-- 2.gr ...
- 【Android测试】【随笔】与 “美丽说” 测试同事交流
◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/5405432.html 分享者简介 雪晗,3年+测试经验,现 ...
- TermServDevices错误
来源TermServDevices的错误日志,日志内容 事类型: 错误 事件来源: TermServDevices 描述 打印机 XXXX 所需的驱动程序 XXX 未知.登录之前,请与 ...
- LightOj 1098 - A New Function(求1-n所有数的因子和)
题目链接:http://lightoj.com/volume_showproblem.php?problem=1098 题意:给你一个数n (0 ≤ n ≤ 2 * 109),求n以内所有数的因子和, ...
- The All-purpose Zero---hdu5773(LIS变形)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5773 题意: 给出n个数,其中 0 可当作任何数,求能够得到的最长上升子序列(严格上升)的长度; 我们 ...
- SQL2000的Enterprise Edition和Developer Edition有什么区别
1.SQL Server 2000 Enterprise Edition(企业版) 该版本具有强大的可伸缩性和可靠性,可作为大型WEB站点.企业联机事务处理(OLTP)以及数据仓库系统等数据库产品的服 ...