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 scaneeling at 2008-09-24 20:57:20 on Problem 1650
while(1)
		{ 
			if(m>l||n>l)
				break;
			
			if(m*1.0/(n*1.0)>=a)n++;
			else m++;
	    	if(fabs(a-x*1.0/(1.0*y))>fabs(a-m*1.0/(n*1.0)))
			{
				x=m;
				y=n;
			}

		}
		printf("%d %d\n",x,y);

while(1)
		{ 
			if(m>l||n>l)
				break;
			if(fabs(a-x*1.0/(1.0*y))>fabs(a-m*1.0/(n*1.0)))
			{
				x=m;
				y=n;
			}
			if(m*1.0/(n*1.0)>=a)n++;
			else m++;
	    	

		}
		printf("%d %d\n",x,y);


刚开始以为这两种情况一样,可是我同学他的能过我的就WA,,,,
后来找了好久用1一测就发现,上面
输出的是1 1而我的是2 2,这就是差别!!!!!!!!!

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