2014年4月17日

HDU1010 Tempter of the Bone dfs(奇偶减枝)

摘要: 直接搜索会超时,需要减枝(奇偶减枝)。#include#includeint n,m,t;char map[7][7];int x0,y0,x1,y1; int flag; int abs(int a) { a>0?:a=-a; return a;}void dfs(int t... 阅读全文

posted @ 2014-04-17 20:44 >_< 阅读(154) 评论(0) 推荐(0) 编辑

HDU1016 Prime Ring Problem 简单dfs

摘要: 数据比较小,可以先枚举出范围内所有的素数用来作判断。注意递归条件。 1 #include 2 int n; 3 int a[20],v[20]; 4 int prime[12]={2,3,5,7,11,13,17,19,23,29,31,37}; 5 int check(int a) 6 { 7 ... 阅读全文

posted @ 2014-04-17 08:56 >_< 阅读(142) 评论(0) 推荐(0) 编辑

导航