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 Andimeo at 2008-02-05 17:59:22 on Problem 3475
#include<stdio.h>

int main(void)
{
	int a,b,c,d;
	while(scanf("%d%d%d%d",&a,&b,&c,&d)==4)
	{
		int m=0,n=0;
		int a1=a,b1=b,c1=c,d1=d;
		while(c1>a1)
		{
			c1>>=1;
			m++;
		}
		while(d1>b1)
		{
			d1>>=1;
			n++;
		}
		int p=0,q=0;
		while(c>b)
		{
			c>>=1;
			p++;
		}
		while(d>a)
		{
			d>>=1;
			q++;
		}
		if(p+q<m+n)
		{
			printf("%d\n",p+q);
		}
		else
		{
			printf("%d\n",m+n);
		}
	}
	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