| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:有个想法In Reply To:有个想法 Posted by:2008011292 at 2010-02-22 22:28:01 #include <iostream>
using namespace std;
int main() {
unsigned long x, t;
int n;
cin >> n;
while (n--) {
cin >> x;
if (x % 2) {
cout << x << " " << x << endl;
continue;
}
t = 1;
while (1) {
if ((t & x) != 0)
break;
t *= 2;
}
cout << x - t + 1 << " " << x + t - 1 << endl;
}
return 0;
}
ac了。。
只是c++ CE。。
只好用g++。。
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator