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

大家帮忙看看这题2309怎么会RE啊!!让人很郁闷的

Posted by 107t at 2006-08-01 15:31:38
#include <iostream>
using namespace std;
int main()
{
	long int time, root, cen;
	long int min, max, tmp;
	cin>>time;
	while(time>0)
	{
		cin>>root;
		cen=2;
		while((root-cen)%(cen*2)!=0)
		{
			cen=cen*2;
		}
		if((root-cen)%(cen*2)==0)// 其左右分别是+/- cen/2
		{
			//tmp;
			max=root;
			min=root;
			for(tmp=cen/2;tmp>1;tmp/=2)
			{
				max+=tmp;
				min-=tmp;
				
			}
			cout<<min-1<<" "<<max+1<<endl;

		}
		time--;
	}
	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