目录
LeetCode3221 生成不含相邻零的二进制字符串
#include <iostream>
#include <vector>
using namespace std;void dfs(string s,int n,vector<string>& res){if(s.size()==n){res.push_back(s);return;}dfs(s+"0",n,res);dfs(s+"1",n,res);
}int main(){int n;cin>>n;vector<string> res;dfs("",n,res);for(int i=0;i<res.size();i++) cout<<res[i]<<endl;return 0;
}