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

怎么用__int64就能过呢?

Posted by halfsix at 2009-07-16 15:08:03 on Problem 1426
#include<iostream>
using namespace std;
int n;
__int64 q[9999999];
void BFS()
{
    int front,rear;
    front=rear=0;
    q[rear]=1;
    rear++;
    __int64 top;
    while(rear>front)
    {
        top = q[front];
        if(top%n==0){
            break;
  }
        top *= 10;
        q[rear++]=top;
        q[rear++]=top+1;
        front++;
    }
    printf("%I64d\n",top);
}

int main()
{
    while(scanf("%d",&n)&&n){
        BFS();
    }
    return 0;
}

不是说100个数字吗?__int64 岂不是不够用?
5406217 halfsix 1426 Accepted 8352K 125MS C++ 491B 2009-07-16 15:05:22 

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