Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求大牛指教为什么过不了,太头疼了

Posted by hewo at 2012-05-09 16:49:06 on Problem 1426
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator