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 2008624 at 2009-09-04 14:17:22 on Problem 2183
#include<stdio.h>
void main()
{
	long a,b,n,i,c,k,e,j,l,sc,sb,sk,sn,fg[90000];
	scanf("%l6d",&a);
   	  for(j=0;;)
	  {	
		n=0;k=1;b=a/10;
		for(i=0;i<4;i++)
		{ c=b%10;n+=c*k;b=b/10;k=k*10; }
        if(n>1000)
            e=4;
	    else
		{
	       if(n>100)
			   	e=3;
		   else
			 {
				if(n>10)
					e=2;
				else
					e=1;
			 }
		}
		sb=0;sb+=n*n;sk=1;sn=0;
    	for(i=0;i<6;i++)
		{ sc=sb%10;sn+=sc*sk;sb=sb/10;sk=sk*10;	}
	    fg[j]=sn;
		for(l=0;l<j;l++)
		{
			if(fg[l]==sn)
			{	
             printf("%ld %d %d\n",sn,e,j+1);
		     break;
			}
		}
		if(l<j)
			break;
		else
		{	a=sn;j++;	}
	  }
}
	



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