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:AC22 at 2008-07-23 21:52:25 #include <iostream> using namespace std ; int main ( ) { int n , i , b , b0 , min , max , x , j ; cin >> n ; for ( i = 0 ; i < n ; i ++ ) { cin >> b ; min = max = b0 = b ; for ( x = 0 ; b0 % 2 == 0 ; x ++ ) { b0 /= 2 ; } for ( j = 0 ; j < x ; j ++ ) { min -= ( 1 << j ) ; max += ( 1 << j ) ; } cout << min << ' ' << max << endl ; } return 0 ; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator