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

Re:附代码,OLE!

Posted by zhongguo at 2006-10-04 13:20:25 on Problem 1183
In Reply To:附代码,OLE! Posted by:Shinjikun at 2006-02-08 18:52:04
> Source
> 
> Problem Id:1183  User Id:Shinjikun 
> Memory:84K  Time:0MS
> Language:C++  Result:Output Limit Exceed
> 
> Source 
> 
> #include <stdio.h>
> #include <math.h>
> typedef unsigned long num;
> 
> 
> int main()
> {
> 	while(1)
> 	{
> 		num a;
> 		scanf("%lu",&a);
> 		{
> 			if(a==0)return 0;
> 			num b,k=0;
> 			num last=0;
> 			num dk;	
> 			num mid=a+sqrt(a*a+1.0);
> 			for(b=a+1;(k==0)|(b<mid);b++)
> 			{
> 				if((b*b+1)%(b-a)==0)
> 				{
> 					dk=(num)((b*b+1)/(b-a));
> 
> 					if((k==0)||(dk<k))k=dk;
> 				}
> 			}
> 			printf("%lu\n",k);
> 		}
> 	}
> 	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