例题9.2Find The Multip
#include
#include
using namespace std;
void BFS(int n)
{
queue q;
q.push(1);
while(!q.empty())
{
long long current=q.front();
q.pop();
if(current%n==0)
{
cout< break;
}
else
{
q.push(current*10);
q.push(current*10+1);
}
}
}
int main()
{
int n;
while(cin>>n)
{
if(n==0)break;
BFS(n);
}
}
#include
using namespace std;
void BFS(int n)
{
queue
q.push(1);
while(!q.empty())
{
long long current=q.front();
q.pop();
if(current%n==0)
{
cout<
}
else
{
q.push(current*10);
q.push(current*10+1);
}
}
}
int main()
{
int n;
while(cin>>n)
{
if(n==0)break;
BFS(n);
}
}
全部评论
相关推荐
小浪_Coding:下次照片务必放出正脸,谢谢
点赞 评论 收藏
分享