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 AC22 at 2008-07-23 21:52:25 on Problem 2309
#include"stdio.h"
#include"math.h"
int main()
{ int m,x,k,p,q,min,max;
  scanf("%d",&m);
  while(m--)
  { scanf("%d",&x);
    if(x%2==1) 
	{ min=x; max=x;
	}
	else
	{ p=1;
	  for(k=1;k<31;k++)
	  { p=p*2; q=p*2;
	    if(x%p==0&&x%q!=0) 
			break;
	  }
	  min=x-p+1; 
	  max=x+p-1;
	}
	printf("%d %d\n",min,max);
  }
  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