symons

___________每一天都是幸福的!!

  博客园  ::  :: 新随笔  ::  :: 订阅 订阅  :: 管理

2013年3月19日

摘要: 这题用了一个优化避免了大数运算。宽搜只搜0和1,找能整除n的只有0,1的十进制数。所以只要mod就可以了,然后就可以把每一个点的模都求出来,然后再*10+1或者*10+0存起来,如果能整除n的话,返回,否则继续找。反正大体上就是这个思路。然后直接提交就超时了,然后我就打了表。 1 #include <string> 2 #include <iostream> 3 #include <queue> 4 using namespace std; 5 6 struct node 7 { 8 string temp; 9 int rem;10 };11 int n; 阅读全文
posted @ 2013-03-19 14:40 symons 阅读(239) 评论(0) 推荐(0)

摘要: 宽搜。 1 #include <iostream> 2 #include <stdio.h> 3 #include <queue> 4 #include <string> 5 #include <string.h> 6 using namespace std; 7 int n,k; 8 int step[100000+10]; 9 void bfs(int begin)10 {11 int t,t1,t2,t3;12 queue<int>haha;13 haha.push(begin);14 step[begin]=0;1 阅读全文
posted @ 2013-03-19 12:18 symons 阅读(325) 评论(0) 推荐(0)