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

其实就是树状数组的lowbit。10行。

Posted by linusc at 2011-03-20 09:47:31 on Problem 2309
In Reply To:Re:有个想法 Posted by:2008011292 at 2010-02-22 22:38:53
#include <cstdio>
using namespace std;

int main() {
  long long x;
  int tcase;
  scanf("%d",&tcase);
  while (tcase--) {
    scanf("%lld",&x);
    printf("%lld %lld\n",x-(x&(-x))+1,x+(x&(-x))-1);
  }
  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