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 2010030402005 at 2011-08-02 18:34:56 on Problem 2309
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
  int n,m;
  cin>>n;
  for(int i=1;i<=n;i++)
    {
      cin>>m;
      int i=0;
      int sum=0;
      for(int p=2;m%p==0;p=p*2)
	i++;
      for(int j=0;j<=i-1;j++)
	{
	  sum +=pow(2,j);
	}
      cout<<m-sum<<" "<<m+sum<<endl;
    }
  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