| ||||||||||
| 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 | |||||||||
表示这个SPJ有问题#include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
__int64 a[250];
int oper[2]={0,1};
__int64 bfs(int n)
{
int j;
queue<__int64> q;
q.push(1);
while(!q.empty())
{
__int64 head,next;
head=q.front();
q.pop();
for(j=0;j<2;j++)
{
next=head*10+oper[j];
if(next%n==0)
return next;
q.push(next);
}
}
}
int main()
{
int i,j;
//freopen("1.txt","w",stdout);
memset(a,0,sizeof(a));
for(i=200;i>=1;i--)
a[i]=bfs(i);
//for(i=99;i>=1;i--)
// a[i]=a[2*i];
while(scanf("%d",&i),i)
printf("%I64d\n",a[i]);
return 0;
}
直接预处理全部打出来,竟然报wrong。 而不先预处理就AC了
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator