poj-1426-Find The Multiple(打表水过)】的更多相关文章

POJ 1426   Find The Multiple Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 25734   Accepted: 10613   Special Judge Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representati…
题目传送门 /* 题意:找出一个0和1组成的数字能整除n DFS:200的范围内不会爆long long,DFS水过~ */ /************************************************ Author :Running_Time Created Time :2015-8-2 14:21:51 File Name :POJ_1426.cpp *************************************************/ #include…
POJ 1426 Find The Multiple 题意:给定一个整数n,求n的一个倍数,要求这个倍数只含0和1 参考博客:点我 解法一:普通的BFS(用G++能过但C++会超时) 从小到大搜索直至找到满足条件的数,注意最高位一定为1 假设 n=6  k即为当前所求的目标数,不满足条件则进一步递推 (i 为层数(深度),在解法二的优化中体现,此时可以不管) 1%6=1 (k=1) i=1 { (1*10+0)%6=4 (k=10) i=2 { (10*10+0)%6=4 (k=100) i=4…
POJ 1426 Find The Multiple(寻找倍数) Time Limit: 1000MS    Memory Limit: 65536K Description - 题目描述 Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may as…
POJ.1426 Find The Multiple (BFS) 题意分析 给出一个数字n,求出一个由01组成的十进制数,并且是n的倍数. 思路就是从1开始,枚举下一位,因为下一位只能是0或1,故这个数字只能是1 * 10或者1 * 10 + 1.就按照这种方式枚举,依次放入队列,如果是其的倍数,就输出. 一开始没理解题意,以为是找一个能整除的二进制数,错了半天. 代码总览 #include <cstdio> #include <cstring> #include <algo…
题目链接:id=1426">Find The Multiple 解析:直接从前往后搜.设当前数为k用long long保存,则下一个数不是k*10就是k*10+1 AC代码: /* DFS */ #include <cstdio> #include <iostream> #include <algorithm> #include <queue> using namespace std; long long n; int DEEP; bool…
题目链接: http://poj.org/problem?id=1426 Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there…
题目链接:http://poj.org/problem?id=1426 Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a correspo…
转载自:優YoU  http://user.qzone.qq.com/289065406/blog/1303946967 以下内容属于以上这位dalao http://poj.org/problem?id=1426 题意 给出一个整数n,(1 <= n <= 200).求出任意一个它的倍数m,要求m必须只由十进制的'0'或'1'组成. 分析 首先暴力枚举肯定是不可能的 1000ms 想不超时都难,而且枚举还要解决大数问题.. 要不是人家把这题放到搜索,怎么也想不到用BFS... 解题方法: B…
Find The Multiple Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 18012   Accepted: 7297   Special Judge Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains…