| ||||||||||
| 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 | |||||||||
求高人指点!我先把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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator