3034: 自然数的拆分 摘要:```cpp #include using namespace std; int a[1001]={1},f,b[1001],k,n; void out(int t){//输出函数 …… 题解列表 2023年04月15日 0 点赞 0 评论 367 浏览 评分:6.7
自然数的拆分DFS 摘要:```cpp #include using namespace std; int n,d[9999999]; void dfs(int x,int c) //x表示的是已经找出…… 题解列表 2023年05月05日 0 点赞 0 评论 275 浏览 评分:4.7
自然数的拆分(dfs) 摘要:解题思路:注意事项:参考代码:#include<iostream> #include<cstring> using namespace std; const int N=10010; int …… 题解列表 2023年08月12日 0 点赞 0 评论 360 浏览 评分:7.3
DFS+递归(这题花费我太长时间,仅仅留做纪念,刚接触,大佬勿喷!!!) 摘要:解题思路:DFS注意事项:以后的每一项都要比当前的数大参考代码:#include<iostream>using namespace std;int n;int a[100]={1};void dfs(…… 题解列表 2023年11月13日 0 点赞 4 评论 297 浏览 评分:8.0
题目 3034: 自然数的拆分 摘要:算法介绍: 本题使用的算法为深度优先搜索算法(Depth-First-Search,DFS),该算法所遵循的策略如同名字一样,讲究一个“深”字,就是尽可能深的去搜锁所有的节点,直到把所有…… 题解列表 2023年11月26日 0 点赞 0 评论 201 浏览 评分:7.3
编写题解 3034: 自然数的拆分(DFS) 摘要:解题思路:1,首先,定义了一个名为dfs的函数,该函数接受一个参数u,表示当前节点的值。2,在dfs函数内部,首先判断u是否等于0且路径长度大于1。如果满足条件,说明已经找到了一条满足条件的路径,将路…… 题解列表 2024年03月13日 0 点赞 0 评论 214 浏览 评分:8.0
基础的递归拆分输出 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;#define endl '\n'#define int long…… 题解列表 2024年04月18日 0 点赞 0 评论 105 浏览 评分:0.0
dfs简单易懂--来自蒟蒻的题解 摘要:# 欢迎各位赏脸来看本蒟蒻的题解 ~~保姆级教程~~(不是) 一眼dfs 但是可能会遇到重复加的问题 导致答案错误 ##### 其实只要 思考一下dfs递归的本质 就会发现 只需要加一个 特判就可…… 题解列表 2024年09月12日 0 点赞 1 评论 179 浏览 评分:8.0
最简自然数的拆分 摘要:参考代码:#include <iostream> #include <stdlib.h> #include <stdio.h> #include <string.h> using namesp…… 题解列表 2024年11月30日 0 点赞 0 评论 151 浏览 评分:9.9