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 635977234 at 2011-05-03 20:30:09 on Problem 2551
我先把111...放到数组中,然后依次判断能否整除n。  9901运行都正确,n<10000.  为什么WA?   小弟比较水,还望高手不吝赐教。

#include<stdio.h>
int main(){
    int n,k,i;
    __int64 a[20];
    a[0]=1;
    for(i=1;i<20;i++)
        a[i] = a[i-1]*10+1;
    while(scanf("%d",&n)!=EOF){
        for(i=0;i<20;i++)
            if(a[i]%n==0){
                k = i;
                break;
            }
        printf("%d\n",k+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