自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Acder的专栏

永不止步

  • 博客(24)
  • 资源 (1)
  • 收藏
  • 关注

转载 hdu2489(重要) 列举n 个数中m个数(double型间的比较不是简单的等于号就可以

#include #include #include using namespace std; const int inf = 99999999; const int M = 1000; int vist[M]; int Map[M][M]; int node[M]; int g[M][M]; int dist[M]; int value[M]; int ans[M]; int n, m

2014-03-30 20:54:31 575

转载 poj2449 (重要)优先队列

#include #include #include #include #include using namespace std; const int inf = 99999999; const int M = 1005; int dist[M]; int vist[M]; int num[M]; struct node { int u; int w; n

2014-03-30 20:51:06 555

转载 hdu3873 (优先队列)

本题对我而言算难题了, 遇到的问题 1 被保护点与保护点的存储问题,  解决方法  bf[a].push_back(i); i为被保护点, a为保护点,这样可以再占领a点时,很容易把a点保护的点删去, 2 对优先队列中出队列的点的含义比清楚,含义 此点应该是距离起点距离最近的, 且此不会再如队列。 3 应该把出队列的点的所有保护的城市的保护数减1 , 更重要的是把他保护的城市的最晚保护时间

2014-03-27 21:19:49 713

转载 HDU3938 Portal 并查集

10 10 10 7 2 1 6 8 3 4 5 8 5 8 2 2 8 9 6 4 5 2 1 5 8 10 5 7 3 7 7 8 8 10 //查询长度 6 1 5 9 1 8 2 7 6#include #include #include #include using namespace std; const int M = 10005;

2014-03-24 19:44:54 642

转载 hdu1811

#include #include #include #include #include using namespace std; const int M = 10005; /* 很好的题目, 对于没有等号的关系, 我们只用拓扑排序就能解决, 但是, 对于等于的关系,就不好解决了, 这里用并查集来辅助,当两点相等时 将其合并, 只看本集合的根元素即可, */ struct nod

2014-03-24 10:26:08 540

转载 hdu1198 并查集(值得复习)

#include #include #include using namespace std; /* 个人感觉本解法非常好, */ char sign[11][5]={"1010","1001","0110","0101","1100","0011", "1011","1110","0111","1101","1111"}; int Set[100][1

2014-03-23 13:24:20 598

原创 hdu1829向量法

#include #include #include #include #define MAX 100002 using namespace std; int father[MAX],rank[MAX]; void init(int n) { for(int i = 1; i <=n; i ++) father[i] = i; memset(rank,

2014-03-22 21:49:51 573

原创 hdu1598

#include #include #include #include using namespace std; const int M = 1005; int Set[M]; struct node { int x; int y; int v; }; node s[M]; int n, m; bool cmp(node p1, node p2) {

2014-03-22 20:36:15 677

原创 poj1182 食物链

#include #include #include #include using namespace std; const int M = 50005; struct node { int p; int relation; }s[M]; int n, m; int Find(int x) { if(x == s[x].p) return

2014-03-22 20:31:30 505

原创 杭电1829 A Bug's Life

#include #include #include using namespace std; const int M = 4005; int Set[M]; int T, n,m; void init() { for(int i = 1; i <= n*2; i++) { Set[i] = i; } } int Find(int x) {

2014-03-22 20:09:44 651

原创 poj 1988

#include #include #include using namespace std; const int M = 30005; int Set[M]; int sum[M]; //记录各点树对应的节点数。 int up[M]; //记录当前节点上面有多少个盒子。 int n, m; void init() { for(int i = 1; i < M; i++)

2014-03-22 20:04:28 655

转载 poj2236

#include #include #include #include #include using namespace std; struct node {     int x;     int y; }s[1005]; int Set[1005]; int vist[1005]; int n; double m; b

2014-03-22 19:59:05 554

原创 poj 1703

#include #include #include using namespace std; const int M = 100005; int Set[M*2]; int n, m; int Find(int x) {     return x == Set[x] ? x : Set[x] = Find(Set[x]);

2014-03-22 19:56:02 557

原创 hdu 1325 Is It A Tree?

#include #include #include using namespace std; const int M = 1005; int vist[M], Set[M]; int du[M]; int a, b, maxn; int flag, cont, k; /* 形成树的条件是, 每一个节点的入度只能为1, 且根只能有一个。 */ int Find(int x) {

2014-03-22 19:50:58 545

原创 hdu1272 小希的迷宫

#include #include int set[100001]; int visited[100001]; int find(int x) { int r=x; /* while(r!=set[r]) r=set[r]; return r;*/ return x == set[x] ? x :set[x] = find(set[x]);

2014-03-22 19:43:36 593

转载 打表代码

//freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); #include using namespace std; int a[]={0,1 ,2 ,3 ,4 ,5 ,6 ,8 ,9 ,10 ,12 ,15 ,16 ,18 ,20 ,24 ,25 ,27 ,30 ,32 ,36 ,40 ,45 ,48 ,

2014-03-16 17:17:12 1034

原创 hdu3591The trouble of Xiaoqian(多重背包)

#include #include #include #include using namespace std; int dp[25000]; //dp[i] 表示组成i元钱用的钱的最少张数;(用多重背包求得); int dp1[25000]; //dp1[i] 表示组成i元钱用的最少钱数 (用的是找回的钱组成 用完全背包求得); int c[105], v[105]; int n,

2014-03-10 20:49:21 663

转载 1059 Dividing 背包

#include #include #include using namespace std; /* 本题是对背包知识的复习题, 综合应用了, 背包前三讲的内容; 对于复习很有帮助。 */ struct node { int v; int m; }s[10]; int temp; int dp[200005]; void completePake(int v) {

2014-03-08 20:45:53 804 2

转载 hdu 2159 FATE 二维背包

/* 很明显是二维背包问题, 最近做了一些背包题目,对于背包有所了解, 对于二维背包,如果给给出k种物品必须要选m种, 物品的第i种的选取,必须由i-1种来决定, 让物品前后有依赖关系, 才能保证,成功选取m种物品; 对于不要去选取件数的二维背包就简单了。 */ #include #include #include using namespace std; int n, m, k,

2014-03-08 16:32:49 747 1

原创 3496 Watch The Movie 二维背包

自己写的 #include #include #include using namespace std; int dp[1005][1005]; int n, t, m, l; int w[105], v[105]; int main() { scanf("%d", &t); while(t--) { scanf("%d%d%d", &n, &m, &

2014-03-07 21:42:20 609

原创 hdu2660 Accepted Necklace 二维背包

#include #include #include using namespace std; /* 物品总个数的限制 有时,“二维费用”的条件是以这样一种隐含的方式给出的: 最多只能取M件物品。这事实上相当于每件物品多了一种“件数”的费用, 每个物品的件数费用均为1, 可以付出的最大件数费用为M。 换句话说,设f[v][m]表示付出费用v、最多选m件时可得到的最

2014-03-07 21:06:13 686

原创 hdu3033I love sneakers! 分组背包

#include #include #include using namespace std; /* 本题是很好的分组背包题目;难点在于如何知道每种牌子的鞋, 都买了至少一双, 自己没有思路, 看别人的代码, 关键在于对dp[][]的初始化, 这样做 memset(dp, -1, sizeof(dp)); memset(dp[0], 0, sizeof(dp[0])); */ stru

2014-03-07 18:45:42 554

转载 hdu 1712ACboy needs your help 01背包(分组)

#include #include #include using namespace std; /* 本题的难点是, 物品和价值不易分离, 需要外加一层循环处理天数和价值间的关系; */ int main() { int dp[105]; int value[105][105]; int n, m; while(scanf("%d%d", &n, &m)

2014-03-06 19:35:23 610

原创 hdu 2639Bone Collector II 01背包第k大问题

#include #include #include #include using namespace std; int n; int N, V, K; int dp[1005][105]; int v[105], w[105]; int sum[305]; int main() { scanf("%d", &n); while(n--){ scanf

2014-03-06 18:53:14 595

网页设计模板 原创

网页设计 基本模板 可以帮助你 网页设计作业

2013-05-10

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除