摘要: dfsid。因为dfs的顺序不能保证数字序小的组合先被搜索到,所以搜到第一个可行解时候不能输出,而应该拷贝到候选数组中。并在此后搜索时直接跳过大于候选集数字序的搜索。/*ID: zhangyc1LANG: C++TASK: milk4*/#include <string>#include <cstring>#include <cstdlib>#include <cstdio>#include <cmath>using namespace std;int Q, N, nCheck;int arrVol[100], arrAns[100] 阅读全文
posted @ 2013-05-09 12:12 J.Z's World 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 这个也不记得了,反正不难/*ID: zhangyc1LANG: C++TASK: wissqu*/#include <string>#include <cstring>#include <cstdlib>#include <cstdio>#include <cmath>using namespace std;char arrMatrix[4][5];bool arrNewCow[4][4], bFound = false;int arrCowNum[5] = {3, 3, 3, 4, 3};int nValid = 0;struct 阅读全文
posted @ 2013-05-09 12:08 J.Z's World 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 非随机版的模拟退火/*ID: zhangyc1LANG: C++TASK: fence3*/#include <string>#include <cstring>#include <cstdlib>#include <cstdio>#include <cmath>using namespace std;int N;struct SLine { int nMin, nMax, nConst; bool bParallelX;//0 - 平行X轴, 1 - 平行Y轴};SLine arrLine[150];int arrStepX[4] 阅读全文
posted @ 2013-05-09 12:06 J.Z's World 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 已经不记得这个题目是什么了。/*ID: zhangyc1LANG: C++TASK: snail*/#include <string>#include <cstring>#include <cstdlib>#include <cstdio>#include <cmath>using namespace std;int N, B, nMaxSetp = 0, nCurStep = 0;bool arrIsBar[120][120], arrVisited[120][120];int arrDirectionX[4] = {0, 1, 0 阅读全文
posted @ 2013-05-09 12:04 J.Z's World 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 用的就是后缀数组。最近非常烦躁。谁人定我去或留,定我心中的宇宙。/*ID: zhangyc1LANG: C++TASK: theme*/#include <string>#include <cstring>#include <cstdlib>#include <cstdio>using namespace std;#define MAXSIZE 5000#define MAXDIF 176int N;int arrNum[MAXSIZE], arrRank[MAXSIZE], arrSufix[MAXSIZE], arrHeight[MAXSIZ 阅读全文
posted @ 2013-05-09 12:03 J.Z's World 阅读(154) 评论(0) 推荐(0) 编辑