
搜索
文章平均质量分 75
。。。
一米の阳光
这个作者很懒,什么都没留下…
展开
-
【搜索】洛谷官方题单刷题总结~递归与枚举~DFS~BFS
文章目录递归与排列1.排列型枚举2.实现指数型枚举3.递归实现组合型枚举DFS深度优先搜索BFS广度优先搜索递归与排列1.排列型枚举洛谷-全排列按照字典序输出自然数 1 到 n 所有不重复的排列,即 n 的全排列,要求所产生的任一数字序列中不允许出现重复的数字。#include<bits/stdc++.h>using namespace std;int a[10],v[10];int n;void dfs(int x){ if(x==n+1){ for(原创 2022-03-20 15:31:13 · 2044 阅读 · 0 评论 -
Codeforces Round #771 (Div. 2) D.Big Brush(DFS、贪心)
[传送门](Problem - D - Codeforces)题目大意在n * m的网格中,每次使用刷子可以填充2 * 2的格子相同颜色(颜色通过数字表示,不同数字标识不同颜色),给定最终成果,是否能在n*m步填充该网格,求解步骤。解题思路填充的最后一步一定是完整的2 * 2的格子(绿色格子),而且这个2 * 2的格子 可能覆盖了其他2 * 2的格子,使其他仅最终显示三块,两块(兰色格子)或者一块。所以解题关键是逆推填涂的过程,也就是消去颜色。具体代码#include <iostr原创 2022-02-15 19:43:45 · 462 阅读 · 0 评论 -
Cycle in Graph(Codeforce 263D)简单搜索
description One day Vasya came up to the blackboard and wrote out n distinct integers from 1 to n in some order in a circle. Then he drew arcs to join the pairs of integers (a, b) (a ≠ b), that are ...原创 2019-08-22 09:53:55 · 181 阅读 · 0 评论