08 2017 档案

摘要:总结一下这题的解题步骤: 1.将问题抽象成某种模型,比如这题就是找出一个有d的状态,且要倒水量最小,平时写的都是路径最小 ,用的是普通队列,这题要把倒水量最小考虑进去就需要用优先队列 即:用优先队列的就是在队列中不断找出倒水量最小的状态,然后判断是否一个容器中的水为d 普通队列可以用来求最短路径长度 阅读全文
posted @ 2017-08-31 12:09 lan126 阅读(166) 评论(0) 推荐(0)
摘要:#include #include #include #include using namespace std; typedef long long ll; int maxd; const int maxn=1000000; int best[maxn]; int ans[maxn]; int first(int a,int b) { int it=1; while... 阅读全文
posted @ 2017-08-30 11:26 lan126 阅读(173) 评论(0) 推荐(0)
摘要:#include #include #include #include #include using namespace std; typedef int state[9]; const int maxstate=1000000; state st[maxstate],goal; int dst[maxstate]; int fa[maxstate]; set vis; cons... 阅读全文
posted @ 2017-08-28 21:49 lan126 阅读(114) 评论(0) 推荐(0)
摘要:在网上搜索了一下我的第一种方法应该是减枝的策略,回溯也是减枝的一种 利用stl全排列,这种方法有个缺点就是当情况比较多时会很慢 回溯法实现,还可以给素数打个表 阅读全文
posted @ 2017-08-27 09:26 lan126 阅读(161) 评论(0) 推荐(0)
摘要:看了看以前的shceme版也好有趣 阅读全文
posted @ 2017-08-25 14:51 lan126 阅读(112) 评论(0) 推荐(0)
摘要:思路就是书上写的从小到大取P中值v插到当前,当然v要是没用过的或者说是没用完的 当有重复时要跳过重复的值 利用stl快速实现 阅读全文
posted @ 2017-08-22 16:58 lan126 阅读(117) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 4 using namespace std; 5 6 int main() 7 { 8 int k; 9 cin>>k; 10 11 int count=0; 12 13 for(int y=k+1;y=y) 18 printf("1/%d=1/%d+1/%d... 阅读全文
posted @ 2017-08-21 21:36 lan126 阅读(135) 评论(0) 推荐(0)
摘要:思路:用数组存储 然后枚举起点和终点来创建子序列由于乘积很大所以要用long long 同时使用cout输出避免printf不同编译器的不同实现 阅读全文
posted @ 2017-08-21 12:01 lan126 阅读(148) 评论(0) 推荐(0)
摘要:除法 阅读全文
posted @ 2017-08-21 11:29 lan126 阅读(142) 评论(0) 推荐(0)
摘要:Idealpath 双向bfs输出颜色,邻接矩阵实现 邻接表实现最短距离 阅读全文
posted @ 2017-08-20 16:59 lan126 阅读(356) 评论(0) 推荐(0)
摘要:Ideal Path 不熟悉父节点方式 自己先敲了一遍 1.发现需要vis数组来进行mark 2.无论是push过程还是pop过程发现目标节点都可以开始打印,但是push过程如果有多个parent节点会有错误. 不记录父节点的bfs 阅读全文
posted @ 2017-08-19 11:39 lan126 阅读(139) 评论(0) 推荐(0)
摘要:#include #include #include using namespace std; const int maxn=210; char buf[maxn][maxn]; int n; bool isnode(char ch) { if(ch=='-' || ch=='|' || ch==' ' || ch==0 || ch=='\n') retu... 阅读全文
posted @ 2017-08-17 18:04 lan126 阅读(114) 评论(0) 推荐(0)
摘要:1 (defparameter *small* 1) 2 (defparameter *big* 100) 3 4 (defun guess-my-number () 5 (ash (+ *small* *big*) -1)) 6 7 (defun smaller () 8 (setf *big* (1- (guess-my-number))) 9 (gue... 阅读全文
posted @ 2017-08-11 18:33 lan126 阅读(130) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 const int maxn=1000; 9 int UG[maxn][maxn]; 10 int vis[maxn]; 11 char str[1024]; 12 int in[maxn]; ... 阅读全文
posted @ 2017-08-10 19:18 lan126 阅读(118) 评论(0) 推荐(0)
摘要:uva10305 深度优先用来找入度为零0的节点 1.如果是有环的有向图则返回false 实现的代码为第九行 2.利用for循环来对节点间可能的联系进行判断,从而实现在边上移动. 拓扑排序 阅读全文
posted @ 2017-08-08 15:54 lan126 阅读(163) 评论(0) 推荐(0)
摘要:uva 816 阅读全文
posted @ 2017-08-07 17:28 lan126 阅读(193) 评论(0) 推荐(0)
摘要:图:油田 阅读全文
posted @ 2017-08-05 23:18 lan126 阅读(124) 评论(0) 推荐(0)
摘要:没看解答敲了一遍,发现自己题目的理解能力有点差 虽然能实现四叉树的合并但并不能算出像素:-( 然后看答案后又敲了遍 阅读全文
posted @ 2017-08-04 22:22 lan126 阅读(127) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int const maxn=10000; 8 int sum[maxn]; 9 10 11 void built(int p) 12 { 13 int v; 14 cin>>v; 15 16 if(v==-1)... 阅读全文
posted @ 2017-08-02 17:26 lan126 阅读(105) 评论(0) 推荐(0)
摘要:本来准备模仿前几题建树来做,但是发现判断部分还是要写出答案那样. 阅读全文
posted @ 2017-08-02 07:19 lan126 阅读(143) 评论(0) 推荐(0)