随笔分类 - dfs
摘要:https://www.luogu.org/problem/show?pid=1378 思路简单的搜索题。 但是!这题真的是让我挠心啊! 请看注释的那两行,为什么!!(表示被这样坑了一天)#include#include#include#include #include#define...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1120#sub 枚举最小长度(从max–>sum),用dfs来判断,如果能成功就可以,退出即可。 dfs中有好多高深的剪枝!! 先将长度降序排序,便于剪枝。剪枝: 判断当前的len时 1).如果在前面已经...
阅读全文
摘要:【问题描述】 有一种圆桌游戏是这样进行的:n个人围着圆桌坐成一圈,按顺时针顺序依次标号为1号至n号。对1#include#includeusing namespace std;int n,f[109][109],dp[209][209],id[209];int main(){...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=2667#subn#include#include#include#includeusing namespace std;int n,ans[101],cnt;bool Isprime(int x){ ...
阅读全文
摘要:https://www.luogu.org/problem/show?pid=1092好一道搜索题! 一开始我自己写了一个史上最无脑的搜索,结果只得了10分,全部TLE掉。参考了题解,才发现自己的暴力搜方法不太对,我是枚举数的每一位是每一个数。。。就是好无脑,不超时才怪。参考了题解(...
阅读全文

浙公网安备 33010602011771号