摘要: /*f[1] = 1;f[2] = min(f[1]*2,f[1]*3,f[1]*5,f[1]*7) = 2;f[3] = min(f[2]*2,f[1]*3,f[1]*5,f[1]*7) = 3;f[4] = min(f[2]*2,f[2]*3,f[1]*5,f[1]*7) = 4;f[5] = min(f[3]*2,f[2]*3,f[1]*5,f[1]*7) = 5;f[6] = min(f[3]*2,f[2]*3,f[2]*5,f[1]*7) = 6; | |f[7] = min(f[4]*2,f[3]*3,f[2]*5,f[1]*7) = 7;f[8]... 阅读全文
posted @ 2013-04-12 17:03 细胞核 阅读(218) 评论(0) 推荐(0) 编辑
摘要: /*a<b<c<d容易证明:(a-b)^2+(c-d)^2 < (a-c)^2+(b-d)^2即此题可以先排序,然后相邻的两个平方差最小dp[i][j]表示i件物品选取j对 的最小疲劳度,w[i]表示第i件物品的重量方程为: i==j*2 dp[i][j] = dp[i-2][j-1]+(w[i]-w[i-1])*(w[i]-w[i-1]); i>j*2 dp[i][j] = min(dp[i-1][j],dp[i-2][j-1]+(w[i]-w[i-1])*(w[i]-w[i-1]));2 11 34*/#include <cstdio>#inclu 阅读全文
posted @ 2013-04-12 17:00 细胞核 阅读(135) 评论(0) 推荐(0) 编辑
摘要: /*数塔变形一看代码 就明白65 14 16 17 27 28 304*/#include <cstdio>#include <cstdlib>#include <iostream>#include <cstring>#include <algorithm>#include <cmath>using namespace std;int dp[100002][11];int main(){ int n; int t,pos; int max_t=0; while(scanf("%d",&n),n! 阅读全文
posted @ 2013-04-12 16:56 细胞核 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #include <cstdio>#include <cstdlib>#include <iostream>#include <cstring>#include <algorithm>#include <cmath>using namespace std;struct Node{ int start; int stop;}a[101];bool cmp(const Node a,const Node b){ if(a.stop!=b.stop)return a.stop<b.stop;}int main(){ int 阅读全文
posted @ 2013-04-12 16:54 细胞核 阅读(212) 评论(0) 推荐(0) 编辑