#include <iostream>
using namespace std;
int n;
bool ok;
void dfs(long long x,int cnt){
if(cnt>=19){ //递归出口1
return;
}
if(ok){ //最优性剪枝
return;
}
if(x%n==0){
ok=true;
cout<<x<<endl;
return;
}
dfs(x*10+0,cnt+1);
dfs(x*10+1,cnt+1);
}
int main(){
cin>>n;
dfs(1,0);
return 0;
}
【深搜剪枝】找数字
最新推荐文章于 2024-07-12 18:02:43 发布