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 delong at 2007-04-26 20:43:34 on Problem 1781
#include <iostream.h>
int main()
{
  long n;
  char ch;
  int e;
  long t;
  int i;
b:
  while(1)
  {
	  cin>>ch;
	  n = ch-'0';
	  cin>>ch;
	  n *= 10;
	  n += ch-'0';
	  cin>>ch;
	  cin>>e;
      if(n == 0)break;
	  for(i = 0;i < e;i++)
	  {
		  n += n<<2;
		  n <<= 1;
	  }
	  if(n == 1)
	  {
		  cout<<"1"<<endl;
		  goto b;
	  }
	  for(i=1;(1<<i) <n;i++);
	  i--;
	  t=2*(n-(1<<i))+1;
	  t = t%n;
	  cout<<t<<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