#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
LL n;
//题目要求每一位的数字是1或者0;
//那么问题是如何寻找呢?
//搜索树的如何画呢? 1->10,1->11;10->100,10->101;11->110,11->111;
bool dfs(LL x,int k)
{
if(x%n==0){
printf("%lld\n",x);
return 1;
}
if(k>=19) return 0;
if(dfs(x*10,k+1)) return 1;
if(dfs(x*10+1,k+1)) return 1;
return 0;
}
int main()
{
while(scanf("%lld",&n)&&n)
{
dfs(1,1);
}
return 0;
}
Find The Multiple+搜索
最新推荐文章于 2020-12-23 14:31:33 发布