1 2 3 4
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 20 下一页
摘要: #include<iostream> #include<Windows.h> #include<winsock.h> #include <assert.h> #include<string> using namespace std; #pragma comment(lib, "ws2_32.lib" 阅读全文
posted @ 2020-04-23 00:34 Lesning 阅读(202) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/problem/13611 其实把,把树分成k个连通块有几种分配方法= 从树上取下k-1条边有几种取法,排列组合就行了,,,,,, #include<iostream> #include<algorithm> using namespace s 阅读全文
posted @ 2020-04-12 18:12 Lesning 阅读(131) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/5086/C 其实不难,让a堵在c到1的毕竟之路上就好了,需要注意,若是a和c同时到1号点就是no,同时到其他点就是yes。。。。坑了好久我的妈呀 代码公式含义:len a到c 1的必经路的长度,假设到x点 ans b到c加上c 阅读全文
posted @ 2020-04-07 21:56 Lesning 阅读(143) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/problem/13249 #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<vector> using namespace s 阅读全文
posted @ 2020-04-07 18:58 Lesning 阅读(135) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/4912/A 过这个题有个前提,需要知道删除哪条边 必须是直径上的边 为什么? 如果不删直径上的边答案就不可能减少了,建议多画画试一下 抓住直径两端s和t开始树形DP, 具体看代码吧 #include<iostream> #in 阅读全文
posted @ 2020-04-04 23:20 Lesning 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 如下图 #include<iostream> #include<cstring> #include<algorithm> #include<cstdio> using namespace std; int dp[1010][1010]; char list[1010]; char ans[1010] 阅读全文
posted @ 2020-04-04 18:11 Lesning 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 分层图,每个转弯定义为一个操作,所以建立一个上层全是x轴,下层全是y轴,两层之间连一条权值为1的边代表转弯的代价。。挺简单的其实 https://www.luogu.com.cn/problem/P3831 #include<iostream> #include<cstring> #include< 阅读全文
posted @ 2020-03-31 20:34 Lesning 阅读(126) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/4090/F 8说了,就是个树链剖分 当xy之间的距离是奇数,就考虑重新建个1010101010--这样取值的树, 当xy之间距离是偶数,直接就完整的取异或就行了,没啥难得,树链剖分板子题8 #include<iostream> 阅读全文
posted @ 2020-03-26 19:46 Lesning 阅读(134) 评论(0) 推荐(0) 编辑
摘要: https://nanti.jisuanke.com/t/42552 以上是交题网站计蒜客 本题要求找到所有子树的所有重心 性质1 : 两棵树合并,新树的重心在两旧树重心连线上 性质2 :子树的重心一定在重儿子上 性质3 :树上所有点到重心的距离的和最小 当siz[root] - siz[x] > 阅读全文
posted @ 2020-03-24 17:58 Lesning 阅读(385) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/4784/B 这题其实不难,考虑一下什么情况会让答案很大? 如果我想枚举,当p是一个很大的素数的时候就不行了,所以先下手为强,看看p/i是不是素数。 具体看代码就行,难度不大 #include<iostream> #includ 阅读全文
posted @ 2020-03-21 23:38 Lesning 阅读(339) 评论(2) 推荐(1) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 20 下一页