poj 1651 dp 记忆化搜索
题意:
给出n个整数a1,a2,…,an,要求从中取出中间的n-2个数(两端的数不能取),取出每个数的代价为它两边的数和它的乘积,问取出这n-2个数的最小代价为多少?
限制:
3 <= n <= 100; 1 <= ai <= 100
思路:
dp 记忆化搜索
对于每个过程其实就是,枚举最后取的数a[i],然后把区间[l,r]分割成[l,i]和[i,...
分类:
其他好文 时间:
2015-03-13 16:33:14
阅读次数:
115
An army of n droids is lined up in one row. Each droid is described by m integers a1,?a2,?...,?am,
where ai is
the number of details of thei-th type in this droid's mechanism. R2-D2 wants to destr...
分类:
其他好文 时间:
2015-03-13 14:24:35
阅读次数:
152
Problem Description
An Arc of Dream is a curve defined by following function:where
a0 = A0
ai = ai-1*AX+AY
b0 = B0
bi = bi-1*BX+BY
What is the value of AoD(N) modulo 1,000,000,007?Input
There ar...
分类:
其他好文 时间:
2015-03-12 19:23:39
阅读次数:
278
有n根棍子,棍子i的长度为ai,想要从中选择3根棍子组成周长尽可能长的三角形。请输出最长的周长,若无法组成三角形则输出0;
#include
#include
#include
#include
using namespace std;
int main()
{
int n,sum,max1,max2;
int a[110];
while(cin>>n)
{
...
分类:
其他好文 时间:
2015-03-12 19:23:32
阅读次数:
146
题意:N和M。有N个数。M个回答:ai, bi, si。代表:sum(ai...bi)=si。如果这个回答和之前的冲突,则这个回答是假的。问:M个回答中有几个是错误的。思路:如果知道sum(ai...bi)=si。假设下一个是sum(ai,ci)=sj。则sum(ai,ci)肯定也知道了。这很符合并...
分类:
其他好文 时间:
2015-03-12 16:37:05
阅读次数:
93
AI绘制矢量电影图标http://www.fevte.com/tutorial-2299-1.htmlAI绘制水晶质感QUICKTIME图标http://wenku.baidu.com/view/9265a483d4d8d15abe234e6f.html?re=viewIllustrator简单的绘...
分类:
其他好文 时间:
2015-03-12 00:46:12
阅读次数:
149
BC # 32 1002题意:给出一个数组 a 和一个数 K ,问是否存在数对( i , j ),使 ai- ai + 1+……+ (-1)j - iaj;对于这道题,一开始就想到了是前缀和,但是如果只是记录下前缀和数组,那么查找就会成为一个大问题。补题的时候一开始考虑用 hash 数组或者是 se...
分类:
其他好文 时间:
2015-03-11 23:19:55
阅读次数:
205
Problem Description
Lele now is thinking about a simple function f(x).If x = 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10);
And ai(0<=i<=9) can only be 0...
分类:
其他好文 时间:
2015-03-11 21:44:50
阅读次数:
145
#include
#include
using namespace std;
int ai(const char *p){
bool negflag = false;
int rs = 0;
if(*p=='+'||*p=='-'){
negflag=(*p=='-');
p++;
}
while(isdigit(*p)){
rs=rs*10+(*p-'0');
p++;...
分类:
其他好文 时间:
2015-03-11 21:43:30
阅读次数:
143
hdu 4498 自适应simpson
题意:
给出k1,k2,…,kn, a1,a2,…,an 和 b1,b2,…,bn
求函数:
F(x)=min{100,min{ki*(x-ai)^2+bi | 0 < i <= n}}
在坐标上画出的曲线的长度。限制:
1 <= n <= 50; 0 <= ai,bi < 100; 0 < ki < 100思路:
先求出所有交点,然后排序,把函...
分类:
其他好文 时间:
2015-03-11 19:41:44
阅读次数:
116