摘要:
#include #include #include #include using namespace std; int main(){ string s="aaabbbbccccc"; vector v1; int ans=0; do{//排出重复,对于v1中的每个元素进行检查 //如果存在s的旋转或翻转,则跳过 int i=0; f... 阅读全文
摘要:
https://blog.csdn.net/zhangpiu/article/details/50979044 https://blog.csdn.net/MsStrbig/article/details/79823555 阅读全文
摘要:
#include using namespace std; int ans=0; //dfs的深度是牌的类型,每种牌可以选0~4种, //选的牌的总数相加==13..... void dfs(int type,int sum) { if(sum>13) return; if(type==13) { if(sum==13) ans++; retu... 阅读全文
摘要:
#include using namespace std; int n,m,k; long long ans; int data[50][50]; void dfs(int x,int y,int max,int cnt){ if(x==n||y==m) return ; int cur=data[x][y]; if(x==n-1&&y==m-1){ ... 阅读全文
摘要:
之前已经学习过回溯法的一些问题,从这篇文章开始,继续深入学习一下回溯法以及其他经典问题。 回溯法有通用的解题法之称。用它可以系统的搜索一个问题的所有解或任一解,回溯法是一个既带有系统性又带有跳跃性的搜索算法。 它的问题的解空间树中,按深度优先策略,从根结点出发搜索解空间树。算法搜索至解空间树的任一结 阅读全文
摘要:
#include #include using namespace std; bool check(const string &s){ if(s.rfind('A')-s.find('A')==2&& s.rfind('2')-s.find('2')==3&& s.rfind('3')-s.find('3')==4&& s.rfind('4')-s.find('... 阅读全文