
dfs
只有魔法才能对抗魔法
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
afecracker HDU - 1015
http://acm.hdu.edu.cn/showproblem.php?pid=1015题解 就是找复合题中给定的表达式的五个字母 搜索 注意回溯#include<cstdio>#include<cstring>#include<string.h>#include<algorithm>#include<iostream&g...原创 2019-03-14 08:31:21 · 117 阅读 · 0 评论 -
HDU 2266
http://acm.hdu.edu.cn/showproblem.php?pid=2266题解 : 两个dfs同时搜 因为是可以又加又减的 注意回溯#include<cstdio>#include<cstring>#include<string.h>#include<algorithm>#include<iostream&...原创 2019-03-15 10:29:01 · 249 阅读 · 0 评论 -
洛谷 p1605
被坑了一手起点要标记dfshttps://www.luogu.org/problemnew/show/P1605#include<cstdio>#include<cstring>#include<string.h>#include<algorithm>#include<iostream>#include<...原创 2019-03-16 09:41:05 · 252 阅读 · 0 评论 -
洛谷 P1140 01迷宫 dfs+联通快+打表
https://www.luogu.org/problemnew/show/P1141T掉的方法 直接dfs: 与联通快的写法差不多,但有个问题 是这样搜会重复好多点,因此最好能把每个联通快的个数保存下来下次直接找这个数 正确代码在最下面。#include<cstdio>#include<cstring>#include<string.h>#...原创 2019-03-16 11:19:54 · 162 阅读 · 0 评论 -
Codeforces Round #549 (Div. 2) C Queen
http://codeforces.com/contest/1143/problem/C反着考虑 考虑对立事件即孝顺的留下来#include<cstdio>#include<cstring>#include<string.h>#include<algorithm>#include<iostream>#include&l...原创 2019-04-02 16:56:02 · 159 阅读 · 0 评论 -
2019牛客暑期多校第二场F(爆搜)
https://ac.nowcoder.com/acm/contest/882/F题意:就是给你2N个人 每个人之间都有竞争力,让你组成两个队,使这两个队之间的所有成员竞争力和最大(本队之间无竞争力)题解:两种解法:1.起始两队都为空,爆搜的时候每个人都往两队间放一次,算出队内的成员竞争力最小时,队外的竞争和一定最大。2.a队先放一个人,其他人都放b队,预处理出第一个人和其他所有人的竞争力...原创 2019-07-22 09:23:17 · 255 阅读 · 0 评论 -
2019牛客暑期多校训练营(第十场)B.Coffee Chicken(递归)
题意 ;给两个字符串,后面的字符串满足斐波那契:s[1]=A,s[2]=B,s[3]=A+B(拼接) A=“COFFEE” B=“CHICKEN” 现在让你输出第n项的字符串的第K位以后的10位字母,如果后面不足10位,输出到末尾即可题解:首先len[A]=6.len[B]=7,根据题目数据范围可知在第58项(斐波那契)的时候 已经有大于1e12的位数了,而K最大是1e1...原创 2019-08-19 11:29:11 · 161 阅读 · 0 评论 -
2019牛客暑期多校训练营(第九场)D.Knapsack Cryptosystem(折半搜索)
题意:就是一个序列去使一个子序列和为给定和题解:数据特别大The first line contains two integers, which are n(1 <= n <= 36) and s(0 <= s < 9 * 10^18)The second line contains n integers, which are {ai}(0 < ai &l...原创 2019-08-20 20:08:20 · 167 阅读 · 0 评论