算法分析与设计_搜索算法
Matrix97
这个作者很懒,什么都没留下…
展开
-
子集和问题
#include <bits/stdc++.h>using namespace std;int n,c,sum=0,flag=0,res=0;//res剩余数字的和,sum当前总数的和int a[10001],vis[10001];bool dfs(int t){ if(sum==c) return true; if(t>n...原创 2018-06-23 21:19:34 · 290 阅读 · 0 评论 -
整数变换问题
题目链接#include<iostream>using namespace std;int k=1;int c=0;//用来记录字符数组位置char a[100] = {'\0'};//用来存放变换序列int select(int n,int m,int s){ if(s==0) return 3*n; else ...原创 2018-06-24 21:20:08 · 582 阅读 · 0 评论 -
运动员最佳匹配问题
题目链接#include <iostream>using namespace std;int n, a[22][22], b[22][22], vis[22], pre[22], ans;void dfs(int x, int s) { if (x > n) { ans = max(ans, s); return; ...原创 2018-06-24 21:41:09 · 1626 阅读 · 0 评论