ZZY的爱好 比赛题 搜索
摘要:
算法:1.只有16种爱好,枚举所有可能,每种爱好要或不要,总共有65536种状态。2.dfs直接枚举每种状态,并保持最优解,刚开始写搓了,dfs超时,原因是搜索没有控制好,搜索的状态变成16!View Code #include<stdio.h>#include<string.h>#include<stdlib.h>#include<iostream>using namespace std;int dt[50][50];int val[50];int hash[100];int visit[100];int sum[100];int tx[20] 阅读全文
posted @ 2012-07-30 16:21 more think, more gains 阅读(127) 评论(0) 推荐(0) 编辑