| ||||||||||
| 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 | |||||||||
为什么!为什么PE!main()
{
int a ,b ,yushu[1200] ,r ,i ,j;
int find;
scanf("%d%d",&a,&b);
while( a != 0 && b != 0)
{
yushu[0] = a;
printf(".");
i = 1;
find = 0;
while(1)
{
r = yushu[i-1]*10/b;
yushu[i] = yushu[i-1]*10%b;
printf("%d",r);
if(yushu[i]==0)
{
find = 2;
break;
}
for( j = 0 ; j < i ; j++)
{
if(yushu[j]==yushu[i])
{
find = 1;
break;
}
}
if(find==1 || find==2)break;
if(i%49==0)printf("\n");
i++;
}/*inside while*/
if(find==1)
{
printf("\nThe last %d digits repeat forever.\n",i-j);
}else{
printf("\nThis expansion terminates.\n");
}
scanf("%d%d",&a,&b);
}/*while*/
}/*main*/
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator