摘要: 题目链接:http://poj.org/problem?id=2531思路:由于N才20,可以dfs爆搞,枚举所有的情况,复杂度为2^(n)。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int map[22][22]; 8 int belong[22]; 9 int n,ans;10 11 void dfs(int pos,int sum)12 {13 if(pos==n+1){14 ans=max(ans,sum);15 return ;16 ... 阅读全文
posted @ 2013-09-02 19:14 ihge2k 阅读(498) 评论(0) 推荐(0) 编辑