上一页 1 ··· 7 8 9 10 11 12 下一页
摘要: 1.采用邻接矩阵才不会超内存,一开始采用edge的结构体存储,结果出现段错误(内存爆满)2.采用并查集的方法,统计时,遇到破坏的城市则不处理,否则进行合并3.最终检查并查集的集合数,集合数-2就是结果(集合数m减去破坏的城市,即m-1,令n=m-1,剩下的集合数n,需要采用n-1条边才能连接起来)/... 阅读全文
posted @ 2015-11-04 12:41 siukwan 阅读(145) 评论(0) 推荐(0)
摘要: 1.首先是平均分A,再到C,M,E2.通过重写不同的cmp函数,使用algorithm.h里面的sort进行排序3.如果分数相同,则排名相同,例如90,80,80,80,70,则排名为1,2,2,2,5//#include//#include #include#include //#include#... 阅读全文
posted @ 2015-11-04 12:38 siukwan 阅读(145) 评论(0) 推荐(0)
摘要: 1.较为简单2.最后的公式为(a*b*c*0.65-1)*2//#include//#include #include#include //#include#include#include#include//#include//#include//#include //#include "func.... 阅读全文
posted @ 2015-11-04 12:36 siukwan 阅读(156) 评论(0) 推荐(0)
摘要: 1.此题较为重点2.最小的radix为各位的数字最大值+13.采用二分法查找,l=radix,r=已知的数+14.要求的最大radix不一定是36//#include//#include #include#include //#include#include#include#include//#in... 阅读全文
posted @ 2015-11-04 12:33 siukwan 阅读(135) 评论(0) 推荐(0)
摘要: 1.直接创建最大的数组2.遍历所有的组合情况//#include//#include #include#include //#include#include#include#include//#include//#include//#include //#include "func.h"//#inc... 阅读全文
posted @ 2015-11-04 12:31 siukwan 阅读(152) 评论(0) 推荐(0)
摘要: 1.注意判断全为负数的情况,第一个数是否为负数,不要漏判断2.实际上采用动态规划,dp[i]=max{dp[i-1]+num[i],num[i]},dp[i]一定会包含当前的数字num[i],但是可以简化为判断dp[i-1]是否为负数//#include//#include #include#inc... 阅读全文
posted @ 2015-11-04 12:29 siukwan 阅读(125) 评论(0) 推荐(0)
摘要: 1.采用algorithm.h里面的sort函数,对时间进行排序,需要重写比较函数//#include//#include #include#include //#include#include#include#include//#include//#include//#include //#inc... 阅读全文
posted @ 2015-11-04 12:27 siukwan 阅读(241) 评论(0) 推荐(0)
摘要: 1.主要是string的位操作,string的每一位都是一个char//#include//#include #include#include //#include#include#include#include//#include//#include//#include //#include "f... 阅读全文
posted @ 2015-11-04 12:25 siukwan 阅读(130) 评论(0) 推荐(0)
摘要: 1.可为多叉树,采用vector保存子树名称2.采用map记录树节点3.采用广度遍历,输出每层的叶子节点数量节点代码如下:struct node{ vector child; int head; string ID; node() :head(-1), child(0), ID(""){};};源代... 阅读全文
posted @ 2015-11-04 12:21 siukwan 阅读(120) 评论(0) 推荐(0)
摘要: 1.采用dijkstra算法,算出最小耗费cost2.利用最小耗费cost最为约束条件,进行遍历搜索(循环->锁->dfs->解锁)//#include//#include #include#include //#include#include#include#include//#include//... 阅读全文
posted @ 2015-11-04 12:15 siukwan 阅读(117) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 下一页