| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
求大牛指教为什么过不了,太头疼了#include<stdio.h>
#include<stdlib.h>
int a[1000000];
long long bfs(long long int n)
{ long long front=0,rear=1;
long long x;
a[front]=1;
while(front<rear)
{x=a[front];
if(x%n==0)
break;
a[rear++]=10*x;
a[rear++]=10*x+1;
front++;
}
return x;
}
int main()
{long long int p,b;
while(1)
{scanf("%lld",&b);
if(b==0) break;
printf("%lld\n",bfs(b));
}
system("pause");
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator