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

c++ T g++ a了

Posted by sll_ at 2014-07-20 17:19:45 on Problem 1426
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include<math.h>
#include<queue>
#define INF 0x7f7f7f7f
using namespace std;
int main()
{
    int i,j,k,l,n;
    long long sum;
    while(scanf("%d",&n)&&n)
    {
        queue<long long>q;
        q.push(1);
        while(!q.empty())
        {
            sum=q.front();
            q.pop();
            if(sum%n==0)
            {
                printf("%lld\n",sum);
                break;
            }
            q.push(sum*10);
            q.push(sum*10+1);
        }
    }
    return 0;
}

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