上一页 1 2 3 4 5 6 7 8 9 10 ··· 14 下一页
摘要: Description In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers: In this problem, you are given n, yo 阅读全文
posted @ 2016-03-03 19:56 我不萌、我要高冷 阅读(423) 评论(0) 推荐(0) 编辑
摘要: 题意:给出一个t代表有t组数据,然后给出n,n代表有n种石头,v代表旅行者的背包容量,然后给出n种石头的价值和容量大小,求能带走的最大价值 思路:01背包问题,每种石头只有拿与不拿两种状态、(其实我是为理解dp而来的) 一维数组也能过、只是第二层必须反序来、顺序的话同一件物品可能会被取多次 贴一份W 阅读全文
posted @ 2016-03-01 16:44 我不萌、我要高冷 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 题意:有一个存钱罐,空罐时的重量是e,满罐时的重量是f,现在有n种硬币,每一种有无限个,现在给出每一种硬币的价值p和重量w,问存钱罐中最少钱,输出最小钱,否则输出... 思路:变形的完全背包问题,只是求最小值 1 #include<cstdio> 2 #include<cstring> 3 #inc 阅读全文
posted @ 2016-03-01 16:38 我不萌、我要高冷 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 1 #include<cstdio> 2 #include<cmath> 3 #include<cstring> 4 const int qq=1000+10; 5 double dist[qq]; 6 double city[qq][qq]; 7 int vis[qq]; 8 int n,m; 9 阅读全文
posted @ 2016-02-28 22:40 我不萌、我要高冷 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 思路:枚举所有起点城市然后比较每个起点所去喜欢城市的最小距离 1 #include<cstdio> 2 #include<cmath> 3 #include<cstring> 4 const int qq=1000+10; 5 const int MAX=1e7; 6 int s[qq],e[qq] 阅读全文
posted @ 2016-02-28 22:34 我不萌、我要高冷 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 转载自:http://www.cnblogs.com/biyeymyhjob/archive/2012/07/31/2615833.html 最短路径—Dijkstra算法和Floyd算法 Dijkstra算法 1.定义概览 Dijkstra(迪杰斯特拉)算法是典型的单源最短路径算法,用于计算一个节 阅读全文
posted @ 2016-02-28 22:31 我不萌、我要高冷 阅读(1754) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<math.h> 3 #include<string.h> 4 const int qq=100+10,MAX=1e7; 5 int vis[qq]; 6 int lowcost[qq][qq]; 7 int minimum[qq]; 8 阅读全文
posted @ 2016-02-27 20:01 我不萌、我要高冷 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<cmath> 5 #include<cstring> 6 #define MAX 0xffffffff //定义一个最小生成树中不可能达到的值 7 con 阅读全文
posted @ 2016-02-27 10:52 我不萌、我要高冷 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 克鲁斯卡尔(kruskal) 1 //kruskal算法生成最小生成树、 2 3 //对边集数组Edge结构的定义 4 typedef struct 5 { 6 int begin; 7 int end; 8 int weight; 9 }Edge; 10 void Minispantree_kru 阅读全文
posted @ 2016-02-16 10:05 我不萌、我要高冷 阅读(478) 评论(0) 推荐(0) 编辑
摘要: 代码线段树入门整理中有介绍、 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 #include<cmath> 5 using namespace std; 6 const int MAXNODE=1<<19; 7 cons 阅读全文
posted @ 2016-02-15 09:45 我不萌、我要高冷 阅读(211) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 14 下一页