摘要: 贝贝侠 贝贝侠来自遥远的贝贝山,那是一个美丽的地方 后来贝贝侠邂逅了美丽的小龙女MM 但是很不幸的是 东海龙王很快就派虾兵蟹将私逃出东海龙宫的小龙女MM 抓走了。。。。。。 于是贝贝侠就被上了行囊 去远方寻找梦想 和 小龙女MM 路上碰到了很多江湖人物,包括 飞飞侠,吉吉哥,盼盼姐,三石翁,一枝菊,百晓毛,小灵通,小葱葱。。。。。。 好多好多。。。。。。 阅读全文
posted @ 2012-06-27 01:25 lenohoo 阅读(488) 评论(0) 推荐(0) 编辑
摘要: 题意:求组成数n的组合数分析:动态规划,完全背包#include <stdio.h>#include <string.h>#define re(i,n) for(int i=0;i<n;i++)#define re1(i,n) for(int i=1;i<=n;i++)#define re2(i,l,r) for(int i=l;i<r;i++)#define re3(i,l,r) for(int i=l;i<=r;i++)#define clr(x,y) memset(x,y,sizeof(x))int dp[200] , n;int main 阅读全文
posted @ 2012-07-12 22:22 lenohoo 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-07-12 15:56 lenohoo 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 时间复杂度:n*log nView Code #include <cstdio>#include <cstring>#include <iostream>using namespace std;const int maxn = 50005;int dp[maxn] , a[maxn];int Lis(int n) { int len = 1 , left , right , mid; dp[1] = a[1]; for(int i=2;i<=n;i++) { left = 1; right = len; while(left <= r... 阅读全文
posted @ 2012-07-11 13:14 lenohoo 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-07-10 18:24 lenohoo 阅读(151) 评论(0) 推荐(0) 编辑
摘要: http://acm.hrbeu.edu.cn/index.php?act=problem&id=1200题意:两种提问方式: P:输入:对于每一个数1,2……n他之前有几个数比他大 输出:输出n个数的排列方式 I:输入:输入n个数的排列方式 输出:对于每一个数1,2……n他之前有几个数比他大分析:模拟View Code #include <cstdio>#include <cstring>#include <iostream>#include <vector>using namespace std;#define re(i,n) for 阅读全文
posted @ 2012-07-10 12:51 lenohoo 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 题意:类似 套汇,问货币轮流转移一圈会不会有盈利分析:有spfa算法,这里因为数据量比较小所以用了floydView Code #include <cstdio>#include <cstring>#include <iostream>using namespace std;#define re(i,n) for(int i=0;i<n;i++)#define re1(i,n) for(int i=1;i<=n;i++)#define clr(x,y) memset(x,y,sizeof(x))#define inf (1<<29)c 阅读全文
posted @ 2012-07-10 05:47 lenohoo 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-07-08 20:29 lenohoo 阅读(2233) 评论(0) 推荐(0) 编辑
摘要: 流体阻力:F=-kv 阅读全文
posted @ 2012-07-08 10:42 lenohoo 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 题意:一开始有n个点m条边,后来每次加一条边,求加上这一条边后途中有几座“桥”。分析:双连通分量View Code #include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;#define maxn 100010struct Edge{ int u,v,next; int vis;}edge[1000005];int head[maxn];int E=0;void addedge(int u,int v){ edge[E].u 阅读全文
posted @ 2012-07-08 03:10 lenohoo 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 题意:给你n个城市的信息,包括两个城市之间的火车费 和 城市里的公交车费,现在给你两座城市,求从一个城市的火车站出发到达另一座城市的火车站最少花费。分析:floyd 。 注意记录路径,以P[i][j] 表示 i城市 到 j城市 的 最短路经上的 直接与i相邻下一个火车站,每次floyd,如果V[i][j] >V[i][k]+V[k][j],则直接把两条路径叠加到一起,如果V[i][j] == V[i][k] + V[k][j],则对i-->j 和 i-->k-->j的两条路径比较字典序,取小者View Code #include <cstdio>#inclu 阅读全文
posted @ 2012-07-07 00:55 lenohoo 阅读(232) 评论(0) 推荐(0) 编辑