洛谷:P2404 天然数的拆分问题(普及-,回溯搜素)

题目: 分析:虽然是一道很基本的算法题,可是为何放到精华呢? 由于本身以前的搜索大部分都是进行bool返回判断。 可是最近作的几道题都不是这样,没有返回值。 代码: #include<bits/stdc++.h> using namespace std; int m; void f(int rest,int num,vector<int> v) { if(rest==0) { if(v.
相关文章
相关标签/搜索