上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 41 下一页
摘要: dom4j是一个Java的XML API,类似于jdom,用来读写XML文件的。dom4j是一个非常非常优秀的Java XML API,具有性能优异、功能强大和极端易用使用的特点,同时它也是一个开放源代码的软件,可以在SourceForge上找到它. dom4j官方文档:http://... 阅读全文
posted @ 2016-09-29 15:49 StevenLuke 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 二分搜索 #include #include using namespace std;const int MAXN = 100005;const int INF = 1000000005;int n, m;int l[MAXN];bool C(int d) { int last = 0; for... 阅读全文
posted @ 2016-09-29 12:22 StevenLuke 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 二分查找 #include #include using namespace std;const int MAXN = 10005;const int INF = 100005;int n, k;double l[MAXN];bool C(double x) { int num = 0; for... 阅读全文
posted @ 2016-09-29 12:12 StevenLuke 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 最小生成树Kruskal算法。 #include #include using namespace std;const int MAXN = 1005;const int MAXM = 20005;int n, m, a, b, l;int cost[MAXN][MAXN];int par[MA... 阅读全文
posted @ 2016-09-28 15:51 StevenLuke 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 优化算法入门系列文章目录(更新中): 1. 模拟退火算法 2. 遗传算法 一. 爬山算法 ( Hill Climbing ) 介绍模拟退火前,先介绍爬山算法。爬山算法是一种简单的贪心搜索算法,该算法每次从当前解的临近解空间中选择一个最优解作为当前解,直到... 阅读全文
posted @ 2016-09-28 15:44 StevenLuke 阅读(913) 评论(0) 推荐(0) 编辑
摘要: 最大生成树,kruskal将权重取负。如果并查集的大小不等于1,则说明没有将所有的谷仓连接起来,输出-1。 #include #include using namespace std;const int MAXN = 1005;const int MAXM = 20005;int n, m, a... 阅读全文
posted @ 2016-09-28 15:03 StevenLuke 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 最小生成树prim #include using namespace std;const int INF = 1000005;const int MAXN = 105;int cost[MAXN][MAXN];int mincost[MAXN];bool used[MAXN];int n;in... 阅读全文
posted @ 2016-09-28 14:37 StevenLuke 阅读(137) 评论(0) 推荐(0) 编辑
摘要: ArrayList长于随机访问 LinkedList长于插入和删除 阅读全文
posted @ 2016-09-26 19:42 StevenLuke 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 优先队列 先将奶牛排序,考虑每个奶牛作为中位数时,比它分数低(前面的)的那群牛的学费总和left,后面的总和right。然后从分数高往分数低扫描,满足left + y + right #include #include #include using namespace std;const i... 阅读全文
posted @ 2016-09-26 15:05 StevenLuke 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 那么将奶牛按照阳光强度的最小值从小到大排序。 将防晒霜也按照能固定的阳光强度从小到大排序 从最小的防晒霜枚举,将所有符合 minSPF 小于等于该防晒霜的SPF 的奶牛 放入优先队列之中。 然后优先队列是小值先出 所以就可以将优先队列最大值 大于等于 防晒霜的SPF的取出来。 ... 阅读全文
posted @ 2016-09-26 14:00 StevenLuke 阅读(165) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 41 下一页