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) ...
随机推荐
- iOS开发-VFL(Visual format language)和Autolayout
AutoLayout不管是在StoryBorad还是在xib中都相对来说比较简单,VFL(Visual fromat language)可视化语言基本上用到的比较少,在xCode4时候自动布局的概 ...
- gcc的-D和-U参数:宏的设置与取消
http://blog.chinaunix.net/uid-7213338-id-2658068.html gcc的-D和-U参数:宏的设置与取消 2006-10-08 22:59:06 分类: L ...
- nodejs net模块实现socket
var net = require('net'); var client = net.connect({port: 8080}, function() { console.log('连接到服务器!') ...
- 【android学习1】:安装MySQL启动服务失败解决方法
最近需要用到MySQL,从官网上下载了一个安装文件,但是安装时一直弹出如下提示信息: Configuration of MySQL Server 5.7 is taking longer than e ...
- img图片之间的间距问题
[问题]页面中如果有多张图片,那么图片之间会有一些间距,在某些情况下(如切好的图片再次拼接),在显示上就会出现一些问题.效果如下: 对应代码: <div class="f0" ...
- github添加SSH Key
1.背景介绍 缘由:在github上下载goagent时出现错误. 在终端使用命令:git clone git@github.com:phuslu/goagent.git 会报权限错误如下: Clon ...
- [LeetCode] Binary Tree Level Order Traversal 2
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left ...
- MFC之向导页、消息框、文件选择、字体、颜色(三)
属性页对话框的分类 属性页对话框想必大家并不陌生,XP系统中桌面右键点属性,弹出的就是属性页对话框,它通过标签切换各个页面.另外,我们在创建MFC工程时使用的向导对话框也属于属性页对话框,它通过点击“ ...
- ant 执行到javac时运行中止,怎么办?
今天下午我用ant,明明都能打出target.后来改了点代码就不行了,执行到compile的javac时运行中止,真是见鬼了. 在ant构建文件上右击,点击"run as"-> ...
- Python-S13作业-day1-之登陆程序
Python-S13-day1 需求: 1.让用户输入账号密码,账号密码正确,登陆程序,打印欢迎信息: 2.如果账号,或密码输入错误,提示用户重新输入,用户有三次机会: 3.如果用户第三次输入的账号或 ...