摘要: 题意:给出m个数字,要求组合成能够被n整除的最小十进制数。分析:用到了余数判重,在这里我详细的解释了。其它就没有什么了。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MAXN=5555; 9 const int N=22;10 11 struct Node{12 int pre;13 int r;14 int d;15 };16 17 int vis[MAXN];18 int num[N];19 int n,c,m;20 Node... 阅读全文
posted @ 2013-10-01 17:54 Thousand Sunny 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 题意:略过分析:用m个数字组成一个能够被n整除的c进制数的最小值,实际上本题的关键就在于这个最小值上。 首先确定我们的思路是从小到大寻找。先查看一位数,即查看着m个数字是否能被n整除;若不能,就查看任意可能的两位数组合...可是如此一来,预算量太大。于是我们考虑是否存在冗余量。 已知A,B两个数(A 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MAXN=5555; 9 const int N=22; 10 11 struct Node{ 12 ... 阅读全文
posted @ 2013-10-01 17:48 Thousand Sunny 阅读(437) 评论(0) 推荐(0) 编辑
摘要: 题意:矩阵中'#'表示墙,'.'表示通路,要求从起点'*'到达终点'X',途中可能遇到一些门(大写字母),要想经过,必须有对应的钥匙(小写字母)。问能否完成,若能,花费的时间是多少。分析:同hdu 1429,只不过这里用map把四种钥匙标号了,否则爆内存。错误:判断门的条件用 isupper(ch) 表示,所以终点'X'也在这个范围内。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 阅读全文
posted @ 2013-10-01 13:25 Thousand Sunny 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 又开始刷题了题意:略过。分析:主要是确定状态量,除了坐标(x,y)之外,还有一个key状态,就好比手上拿着一串钥匙。状态可以用位运算来表示:key&(x,y)表示判断有没有这扇门的钥匙,key|(x,y)表示捡起了一把钥匙。错误:1、开标记数组mark[][][],key状态大小顺手开成key,其实应该是1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MAXN=22; 9 const int KEY=10; 10 11 int dir[4][2]={0,-1... 阅读全文
posted @ 2013-10-01 11:35 Thousand Sunny 阅读(246) 评论(0) 推荐(0) 编辑