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 |
很长的时候,你的第二行以后都是多一个字符In Reply To:为什么我这会提示格式错误呀!我差了好几遍,没错呀 Posted by:bitsf at 2004-09-23 16:30:41 > #include <stdio.h> > void main(){ > int aa[1000],ba[1000]; > int a,b; > int result[1000]; > int pos=0; > int num=0; > int t; > int hang; > > do{ > scanf("%d %d",&aa[num],&ba[num]); > num++; > }while(aa[num-1]!=0 && ba[num-1]!=0); > > for(t=0;t<num-1;t++) > { > hang=1; > a=aa[t];b=ba[t]; > printf("."); > pos =0; > result[pos++]=a; > a=a%b*10; > while(1){ > int r=a%b; > int p; > if(hang++>=50){printf("\n");hang=0;} > printf("%d",a/b); > if(r==0){ > printf("\nThis expansion terminates.\n"); > break; > } > for(p=pos-1;p>=0;p--){ > if(result[p]==r) > break; > } > if(p>=0){ > printf("\nThe last %d digits repeat forever.\n",pos-p); > break; > } > else > { > a=r*10; > result[pos]=r; > } > pos++; > } > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator