摘要: 题目:http://poj.org/problem?id=1426题意:给出一个整数n,(1 <= n <= 200)。求出任意一个它的倍数m,要求m必须只由十进制的'0'或'1'组成。注意:1、要求的这个数,大数肯定不能存,需要用数组存2、这个数的最高位一定是13、剩下的各个位只有两种可能,要么是1,要么是0,用bfs来处理4、停止bfs的条件是m%n==0,即可以利用上一位的余数×10%n,若等于0,则停止,否则继续。5、最后是输出部分,利用的是同余模定理处理,把*10操作转化为%2操作,逆向输出就可以了代码:View Code 1 # 阅读全文
posted @ 2013-01-26 21:25 琳&leen 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=2251View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #define pan(a,b,c) (a<=b&&b<=c) 5 using namespace std; 6 int dir[6][3]={{0,0,-1},{0,0,1},{-1,0,0},{1,0,0},{0,-1,0},{0,1,0}}; 7 int ex,ey,ez; 8 char str[35][35][35 阅读全文
posted @ 2013-01-26 13:54 琳&leen 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1321没什么难度,比较水。。。View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #define pan(a,n) (a>=1&&a<=n) 5 using namespace std; 6 int n,k; 7 char str[10][10]; 8 int dire[4][2]={{1,0},{0,1}}; 9 int xvis[10],yvis[10];10 int num 阅读全文
posted @ 2013-01-26 13:53 琳&leen 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=3009题意:就是要求把一个冰壶从起点“2”用最少的步数移动到终点“3”其中0为移动区域,1为石头区域,冰壶会一直向着一个方向走下去,一直撞到石头或者到达终点才能改变方向,撞到石头时会停在石头前面而且这块石头会破碎,到终点会停止大概的思路就是:一个方向要是能走就就一直走下去一直到不能再往前走,然后就换方向(此时用while就可以解决,不需要递归调用),还有就是注意场地的恢复View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstrin 阅读全文
posted @ 2013-01-26 13:49 琳&leen 阅读(127) 评论(0) 推荐(0) 编辑